diff --git a/Deepgram.Dev.sln b/Deepgram.Dev.sln
index ad5d1e92..d180c155 100644
--- a/Deepgram.Dev.sln
+++ b/Deepgram.Dev.sln
@@ -135,44 +135,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "http", "http", "{5DFC6330-8
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Streaming", "examples\speech-to-text\websocket\http\Streaming.csproj", "{61B42F6B-521C-4A07-B592-54975F4AE2E6}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "factory_example", "factory_example", "{ACF6E046-747E-440D-BF10-B1E308BF8D60}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "factory_example", "factory_example", "{FCFC3960-C92C-43E4-B864-06B9DF621818}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "factory_example", "factory_example", "{6DFDB911-5172-44F0-A3F1-98C301D7B26F}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "factory_example", "factory_example", "{2B3AF9D0-879A-4B8A-A6EC-0C95F36A1DC5}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\analyze\factory_example\Factory.csproj", "{8B6FC081-6103-49EB-96A3-84FED3F5181D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\manage\factory_example\Factory.csproj", "{92C795B8-9002-447E-BFE5-B227D1BA3B22}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\speech-to-text\rest\factory_example\Factory.csproj", "{CB254D55-5C90-4EAF-8EE7-5C9C284317E7}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\text-to-speech\file\factory_example\Factory.csproj", "{3DD86C52-7EF9-4F96-B057-58DFA30CCD27}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\speech-to-text\websocket\factory_example\Factory.csproj", "{2A876DE1-0D84-4FF5-BE82-7C393B6697B7}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "throw_exception", "throw_exception", "{02746530-6811-4F1B-8851-544C89CA66DA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThrowException", "tests\expected_failures\rest\throw_exception\ThrowException.csproj", "{B98F6A00-292E-431F-8B11-0CFCA5FD1E37}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "speech-to-text", "speech-to-text", "{5EEA8D9D-0C0D-4EE3-93B1-F0133C629478}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "microphone-new", "microphone-new", "{B5F4EE7B-BA3B-4EC8-ABED-283489CDFADF}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Streaming", "examples\speech-to-text\websocket\microphone-new\Streaming.csproj", "{273667D9-8EDE-4B99-A162-DB0CF5930FC3}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rest", "rest", "{C1A7ADF7-ACAC-4B10-8266-C7224156C012}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "websocket", "websocket", "{889B3075-777E-476D-BB18-B1CD647F1893}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "file", "file", "{F2DCE1E6-FC12-4CA5-A738-5A3F359B8A96}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Factory", "examples\text-to-speech\rest\file\factory_example\Factory.csproj", "{10009667-E326-4D72-9794-182B297921F7}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "factory_example", "factory_example", "{AA8CC71C-D796-4992-85C4-3F4B21ED4056}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hello-world", "hello-world", "{F31817AD-AC9F-4021-A9E0-7C26C31D5744}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "woodchuck", "woodchuck", "{E1B8DE3D-2B86-4A60-BDC1-A7F425986DC1}"
@@ -303,34 +279,10 @@ Global
{61B42F6B-521C-4A07-B592-54975F4AE2E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61B42F6B-521C-4A07-B592-54975F4AE2E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61B42F6B-521C-4A07-B592-54975F4AE2E6}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B6FC081-6103-49EB-96A3-84FED3F5181D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B6FC081-6103-49EB-96A3-84FED3F5181D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B6FC081-6103-49EB-96A3-84FED3F5181D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B6FC081-6103-49EB-96A3-84FED3F5181D}.Release|Any CPU.Build.0 = Release|Any CPU
- {92C795B8-9002-447E-BFE5-B227D1BA3B22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {92C795B8-9002-447E-BFE5-B227D1BA3B22}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {92C795B8-9002-447E-BFE5-B227D1BA3B22}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {92C795B8-9002-447E-BFE5-B227D1BA3B22}.Release|Any CPU.Build.0 = Release|Any CPU
- {CB254D55-5C90-4EAF-8EE7-5C9C284317E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CB254D55-5C90-4EAF-8EE7-5C9C284317E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CB254D55-5C90-4EAF-8EE7-5C9C284317E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CB254D55-5C90-4EAF-8EE7-5C9C284317E7}.Release|Any CPU.Build.0 = Release|Any CPU
- {2A876DE1-0D84-4FF5-BE82-7C393B6697B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2A876DE1-0D84-4FF5-BE82-7C393B6697B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2A876DE1-0D84-4FF5-BE82-7C393B6697B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2A876DE1-0D84-4FF5-BE82-7C393B6697B7}.Release|Any CPU.Build.0 = Release|Any CPU
{B98F6A00-292E-431F-8B11-0CFCA5FD1E37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B98F6A00-292E-431F-8B11-0CFCA5FD1E37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B98F6A00-292E-431F-8B11-0CFCA5FD1E37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B98F6A00-292E-431F-8B11-0CFCA5FD1E37}.Release|Any CPU.Build.0 = Release|Any CPU
- {273667D9-8EDE-4B99-A162-DB0CF5930FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {273667D9-8EDE-4B99-A162-DB0CF5930FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {273667D9-8EDE-4B99-A162-DB0CF5930FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {273667D9-8EDE-4B99-A162-DB0CF5930FC3}.Release|Any CPU.Build.0 = Release|Any CPU
- {10009667-E326-4D72-9794-182B297921F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {10009667-E326-4D72-9794-182B297921F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {10009667-E326-4D72-9794-182B297921F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {10009667-E326-4D72-9794-182B297921F7}.Release|Any CPU.Build.0 = Release|Any CPU
{1850D8CC-ADFD-4187-80D4-C5DBDA55B6E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1850D8CC-ADFD-4187-80D4-C5DBDA55B6E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1850D8CC-ADFD-4187-80D4-C5DBDA55B6E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -408,24 +360,12 @@ Global
{8C5A02D8-E18B-4060-A567-A4AACC49B2F6} = {3AC17A9C-30BB-4298-8E5A-4FAE73189821}
{5DFC6330-8303-4045-B186-32B396391D31} = {132EEE99-6194-477A-9416-D7EF173C17FD}
{61B42F6B-521C-4A07-B592-54975F4AE2E6} = {5DFC6330-8303-4045-B186-32B396391D31}
- {ACF6E046-747E-440D-BF10-B1E308BF8D60} = {83D6D1F7-97E1-4E35-A0AA-E3ED5977EA72}
- {FCFC3960-C92C-43E4-B864-06B9DF621818} = {FA5723B3-74E9-4221-80EF-4833C1C3DD9F}
- {6DFDB911-5172-44F0-A3F1-98C301D7B26F} = {77ACBABB-CF6B-4929-957C-480E29646DFD}
- {2B3AF9D0-879A-4B8A-A6EC-0C95F36A1DC5} = {132EEE99-6194-477A-9416-D7EF173C17FD}
- {8B6FC081-6103-49EB-96A3-84FED3F5181D} = {ACF6E046-747E-440D-BF10-B1E308BF8D60}
- {92C795B8-9002-447E-BFE5-B227D1BA3B22} = {FCFC3960-C92C-43E4-B864-06B9DF621818}
- {CB254D55-5C90-4EAF-8EE7-5C9C284317E7} = {6DFDB911-5172-44F0-A3F1-98C301D7B26F}
- {2A876DE1-0D84-4FF5-BE82-7C393B6697B7} = {2B3AF9D0-879A-4B8A-A6EC-0C95F36A1DC5}
{02746530-6811-4F1B-8851-544C89CA66DA} = {7FA977F3-415E-4681-B316-5C273DF3A1C6}
{B98F6A00-292E-431F-8B11-0CFCA5FD1E37} = {02746530-6811-4F1B-8851-544C89CA66DA}
{5EEA8D9D-0C0D-4EE3-93B1-F0133C629478} = {C673DFD1-528A-4BAE-94E6-02EF058AC363}
- {B5F4EE7B-BA3B-4EC8-ABED-283489CDFADF} = {132EEE99-6194-477A-9416-D7EF173C17FD}
- {273667D9-8EDE-4B99-A162-DB0CF5930FC3} = {B5F4EE7B-BA3B-4EC8-ABED-283489CDFADF}
{C1A7ADF7-ACAC-4B10-8266-C7224156C012} = {E2E3000D-FBBA-450E-A4E0-3542B38ADAFD}
{889B3075-777E-476D-BB18-B1CD647F1893} = {E2E3000D-FBBA-450E-A4E0-3542B38ADAFD}
{F2DCE1E6-FC12-4CA5-A738-5A3F359B8A96} = {C1A7ADF7-ACAC-4B10-8266-C7224156C012}
- {10009667-E326-4D72-9794-182B297921F7} = {AA8CC71C-D796-4992-85C4-3F4B21ED4056}
- {AA8CC71C-D796-4992-85C4-3F4B21ED4056} = {F2DCE1E6-FC12-4CA5-A738-5A3F359B8A96}
{F31817AD-AC9F-4021-A9E0-7C26C31D5744} = {F2DCE1E6-FC12-4CA5-A738-5A3F359B8A96}
{E1B8DE3D-2B86-4A60-BDC1-A7F425986DC1} = {F2DCE1E6-FC12-4CA5-A738-5A3F359B8A96}
{1850D8CC-ADFD-4187-80D4-C5DBDA55B6E3} = {F31817AD-AC9F-4021-A9E0-7C26C31D5744}
diff --git a/Deepgram/ClientFactory.cs b/Deepgram/ClientFactory.cs
index 2560447f..041aba16 100644
--- a/Deepgram/ClientFactory.cs
+++ b/Deepgram/ClientFactory.cs
@@ -104,6 +104,18 @@ public static IPreRecordedClient CreatePreRecordedClient(string apiKey = "", Dee
return new PreRecordedClient(apiKey, options, httpId);
}
+ ///
+ /// Create a new ListenRESTClient
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IListenRESTClient CreateListenRESTClient(string apiKey = "", DeepgramHttpClientOptions? options = null, string? httpId = null)
+ {
+ return new ListenRESTClient(apiKey, options, httpId);
+ }
+
///
// *********** WARNING ***********
// This function creates a Speak Client for the Deepgram API
diff --git a/examples/analyze/factory_example/Factory.csproj b/examples/analyze/factory_example/Factory.csproj
deleted file mode 100644
index d0ea3e2e..00000000
--- a/examples/analyze/factory_example/Factory.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Always
-
-
-
-
diff --git a/examples/analyze/factory_example/Program.cs b/examples/analyze/factory_example/Program.cs
deleted file mode 100644
index da380ad6..00000000
--- a/examples/analyze/factory_example/Program.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram.Models.Analyze.v1;
-using Deepgram.Logger;
-
-namespace PreRecorded
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- Library.Initialize();
- // OR to set logging level
- //Library.Initialize(LogLevel.Debug);
-
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var deepgramClient = ClientFactory.CreateAnalyzeClient();
-
- // check to see if the file exists
- if (!File.Exists(@"conversation.txt"))
- {
- Console.WriteLine("Error: File 'conversation.txt' not found.");
- return;
- }
-
- // increase timeout to 60 seconds
- CancellationTokenSource cancelToken = new CancellationTokenSource();
- cancelToken.CancelAfter(TimeSpan.FromSeconds(120));
-
- var audioData = File.ReadAllBytes(@"conversation.txt");
- var response = await deepgramClient.AnalyzeFile(
- audioData,
- new AnalyzeSchema()
- {
- Language = "en",
- Intents = true,
- },
- cancelToken);
-
- Console.WriteLine(response);
- Console.ReadKey();
-
- // Teardown Library
- Library.Terminate();
- }
- }
-}
\ No newline at end of file
diff --git a/examples/analyze/factory_example/conversation.txt b/examples/analyze/factory_example/conversation.txt
deleted file mode 100644
index 2af89e08..00000000
--- a/examples/analyze/factory_example/conversation.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-Meet Deepgram Aura: real-time text-to-speech for real-time AI agents
-----------
-It’s been a year since large language models (LLMs) seemingly went mainstream overnight (Happy Birthday, ChatGPT!!!), and the world has witnessed both rapid development of these technologies and immense interest in their potential. We believe that we have reached an inflection point where voice-based interfaces will be the primary means to accessing LLMs and the experiences they unlock. Here are a few recent signals in support of our thesis:
-
-- Good old fashioned voice notes are enjoying a healthy resurgence.
-
-- According to a recent survey, a majority of respondents stated phone calls are still their preferred communication channel for resolving customer service issues.
-
-- An emerging boom in wearable devices equipped with continuous listening and speech AI technology is gaining steam.
-
-- OpenAI recently enabled voice interactions in ChatGPT.
-
-- A wave of interest in voice-first experiences and tools is sweeping across brands, investors, and tech companies.
-
-Thanks to ChatGPT and the advent of the LLM era, the conversational AI tech stack has advanced sufficiently to support productive (not frustrating) voice-powered AI assistants and agents that can interact with humans in a natural manner. We have already observed this from our most innovative customers who are actively turning to these technologies to build a diverse range of AI agents for voice ordering systems, interview bots, personal AI assistants, automated drive-thru tellers, and autonomous sales and customer service agents.
-
-While these AI agents hold immense potential, many customers have expressed their dissatisfaction with the current crop of voice AI vendors, citing roadblocks related to speed, cost, reliability, and conversational quality. That’s why we’re excited to introduce our own text-to-speech (TTS) API, Deepgram Aura, built for real-time, conversational voice AI agents.
-
-Whether used on its own or in conjunction with our industry-leading Nova-2 speech-to-text API, we’ll soon provide developers with a complete speech AI platform, giving them the essential building blocks they need to build high throughput, real-time AI agents of the future.
-
-We are thrilled about the progress our initial group of developers has made using Aura, so much so that we are extending limited access to a select few partners who will be free to begin integrating with Aura immediately. With their feedback, we’ll continue to enhance our suite of voices and API features, as well as ensure a smooth launch of their production-grade applications.
-
-
-What Customers Want
-----------
-I feel the need, the need for speed
-What we’ve heard from many of our customers and partners is that voice AI technology today caters to two main areas: high production or high throughput.
-
-High Production is all about crafting the perfect voice. It's used in projects where every tone and inflection matters, like in video games or audiobooks, to really bring a scene or story to life. Here, voice quality is king, with creators investing hours to fine-tune every detail for a powerful emotional impact. The primary benefit is the ability to swap out a high-paid voice actor with AI where you have more dynamic control over what’s being said while also achieving some cost savings. But these use cases are more specialized and represent just a sliver of the overall voice AI opportunity.
-
-On the flip side, High Throughput is about handling many quick, one-off interactions for real-time conversations at scale. Think fast food ordering, booking appointments, or inquiring about the latest deals at a car dealership. These tasks are relevant to just about everyone on the planet, and they require fast, efficient text-to-speech conversion for an AI agent to fulfill them. While voice quality is still important to keep users engaged, quality here is more about the naturalness of the flow of conversation and less about sounding like Morgan Freeman. But the primary focus for most customers in this category is on improving customer outcomes, meaning speed and efficiency are must-haves for ensuring these everyday exchanges are smooth and reliable at high volume.
-
-"Deepgram showed me less than 200ms latency today. That's the fastest text-to-speech I’ve ever seen. And our customers would be more than satisfied with the conversation quality."
-
-Jordan Dearsley, Co-founder at Vapi
-
-Although high production use cases seem to be well-served with UI-centric production tools, high throughput, real-time use cases still mostly rely on APIs provided by the major cloud providers. And our customers have been telling us that they’ve been falling short, with insufficient quality for a good user experience, too much latency to make real-time use cases work, and costs too expensive to operate at scale.
-
-
-More human than human
-----------
-With Aura, we’ll give realistic voices to AI agents. Our goal is to craft text-to-speech capabilities that mirror natural human conversations, including timely responses, the incorporation of natural speech fillers like 'um' and 'uh' during contemplation, and the modulation of tone and emotion according to the conversational context. We aim to incorporate laughter and other speech nuances as well. Furthermore, we are dedicated to tailoring these voices to their specific applications, ensuring they remain composed and articulate, particularly in enunciating account numbers and business names with precision.
-
-"I don’t really consider Azure and the other guys anymore because the voices sound so robotic."
-Jordan Dearsley, Co-founder at Vapi
-
-In blind evaluation trials conducted for benchmarking, early versions of Aura have consistently been rated as sounding more human than prominent alternatives, even outranking human speakers for various audio clips more often than not on average. We were pleasantly surprised by these results (stay tuned for a future post containing comprehensive benchmarks for speed and quality soon!), so much so that we’re accelerating our development timeline and publicly announcing today’s waitlist expansion.
-
-Here are some sample clips generated by one of the earliest iterations of Aura. The quality and overall performance will continue to improve with additional model training and refinement. We encourage you to give them a listen and note the naturalness of their cadence, rhythm, and tone in the flow of conversation with another human.
-
-
-Our Approach
-----------
-For nearly a decade, we’ve worked tirelessly to advance the art of the possible in speech recognition and spoken language understanding. Along the way, we’ve transcribed trillions of spoken words into highly accurate transcriptions. Our model research team has developed novel transformer architectures equipped to deal with the nuances of conversational audio–across different languages, accents, and dialects, while handling disfluencies and the changing rhythms, tones, cadences, and inflections that occur in natural, back-and-forth conversations.
-
-And all the while, we’ve purposefully built our models under limited constraints to optimize their speed and efficiency. With support for dozens of languages and custom model training, our technical team has trained and deployed thousands of speech AI models (more than anybody else) which we operate and manage for our customers each day using our own computing infrastructure.
-
-We also have our own in-house data labeling and data ops team with years of experience building bespoke workflows to record, store, and transfer vast amounts of audio in order to label it and continuously grow our bank of high-quality data (millions of hours and counting) used in our model training.
-
-These combined experiences have made us experts in processing and modeling speech audio, especially in support of streaming use cases with our real-time STT models. Our customers have been asking if we could apply the same approach for TTS, and we can.
-
-So what can you expect from Aura? Delivering the same market-leading value and performance as Nova-2 does for STT. Aura is built to be the panacea for speed, quality, and efficiency–the fastest of the high-quality options, and the best quality of the fast ones. And that’s really what end users need and what our customers have been asking us to build.
-
-"Deepgram is a valued partner, providing our customers with high throughput speech-to-text that delivers unrivaled performance without tradeoffs between quality, speed, and cost. We're excited to see Deepgram extend their speech AI platform and bring this approach to the text-to-speech market." - Richard Dumas, VP AI Product Strategy at Five9
-
-
-What's Next
-----------
-As we’ve discussed, scaled voice agents are a high throughput use case, and we believe their success will ultimately depend on a unified approach to audio, one that strikes the right balance between natural voice quality, responsiveness, and cost-efficiency. And with Aura, we’re just getting started. We’re looking forward to continuing to work with customers like Asurion and partners like Five9 across speech-to-text AND text-to-speech as we help them define the future of AI agents, and we invite you to join us on this journey.
-
-We expect to release generally early next year, but if you’re working on any real-time AI agent use cases, join our waitlist today to jumpstart your development in production as we continue to refine our model and API features with your direct feedback.
\ No newline at end of file
diff --git a/examples/analyze/intent/Program.cs b/examples/analyze/intent/Program.cs
index fe9ced6b..a8aef9e6 100644
--- a/examples/analyze/intent/Program.cs
+++ b/examples/analyze/intent/Program.cs
@@ -2,10 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
using Deepgram.Models.Analyze.v1;
-using Deepgram.Logger;
namespace PreRecorded
{
@@ -15,12 +12,10 @@ static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
- //Library.Initialize();
- // OR to set logging level
- Library.Initialize(LogLevel.Debug);
+ Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new AnalyzeClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateAnalyzeClient();
// check to see if the file exists
if (!File.Exists(@"conversation.txt"))
diff --git a/examples/analyze/sentiment/Program.cs b/examples/analyze/sentiment/Program.cs
index e323d9f7..dc3aef93 100644
--- a/examples/analyze/sentiment/Program.cs
+++ b/examples/analyze/sentiment/Program.cs
@@ -2,8 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
using Deepgram.Models.Analyze.v1;
namespace PreRecorded
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new AnalyzeClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateAnalyzeClient();
// check to see if the file exists
if (!File.Exists(@"conversation.txt"))
diff --git a/examples/analyze/summary/Program.cs b/examples/analyze/summary/Program.cs
index fbc098aa..6d3f683c 100644
--- a/examples/analyze/summary/Program.cs
+++ b/examples/analyze/summary/Program.cs
@@ -2,8 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
using Deepgram.Models.Analyze.v1;
namespace PreRecorded
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new AnalyzeClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateAnalyzeClient();
// check to see if the file exists
if (!File.Exists(@"conversation.txt"))
diff --git a/examples/analyze/topic/Program.cs b/examples/analyze/topic/Program.cs
index cd17ceda..0622b28d 100644
--- a/examples/analyze/topic/Program.cs
+++ b/examples/analyze/topic/Program.cs
@@ -2,8 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
using Deepgram.Logger;
using Deepgram.Models.Analyze.v1;
@@ -19,8 +17,8 @@ static async Task Main(string[] args)
// OR very chatty logging
//Library.Initialize(LogLevel.Verbose); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new AnalyzeClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateAnalyzeClient();
// check to see if the file exists
if (!File.Exists(@"conversation.txt"))
diff --git a/examples/manage/balances/Program.cs b/examples/manage/balances/Program.cs
index 28ce7e5a..08d10bdd 100644
--- a/examples/manage/balances/Program.cs
+++ b/examples/manage/balances/Program.cs
@@ -2,11 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
-using Deepgram.Models.Manage.v1;
-
namespace SampleApp
{
class Program
@@ -15,12 +10,10 @@ static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
- //Library.Initialize();
- // OR very chatty logging
- Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+ Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
var response = await deepgramClient.GetProjects();
if (response == null)
diff --git a/examples/manage/factory_example/Factory.csproj b/examples/manage/factory_example/Factory.csproj
deleted file mode 100644
index 33d8f4ee..00000000
--- a/examples/manage/factory_example/Factory.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/manage/factory_example/Program.cs b/examples/manage/factory_example/Program.cs
deleted file mode 100644
index 9d27bece..00000000
--- a/examples/manage/factory_example/Program.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram.Logger;
-using Deepgram.Models.Manage.v1;
-
-namespace SampleApp
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
-
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var deepgramClient = ClientFactory.CreateManageClient();
-
- var response = await deepgramClient.GetProjects();
- if (response == null)
- {
- Console.WriteLine("No projects found.");
- return;
- }
- Console.WriteLine($"\n\n{response}\n\n");
-
- var projectId = "";
- foreach (var project in response.Projects)
- {
- Console.WriteLine($"Using Project ID: {project.ProjectId}");
- projectId = project.ProjectId;
- break;
- }
-
- var balanacesResponse = deepgramClient.GetBalances(projectId);
- if (balanacesResponse == null)
- {
- Console.WriteLine("\n\nNo balance found.\n\n");
- return;
- }
- Console.WriteLine($"\n\n{balanacesResponse}\n\n");
-
- string balanceId = "";
- foreach (var balance in balanacesResponse.Result.Balances)
- {
- Console.WriteLine($"Using Balance ID: {balance.BalanceId}");
- balanceId = balance.BalanceId;
- break;
- }
-
- var balanceResponse = deepgramClient.GetBalance(projectId, balanceId);
- if (balanceResponse == null)
- {
- Console.WriteLine("\n\nNo balance found.\n\n");
- return;
- }
- Console.WriteLine($"\n\n{balanceResponse}\n\n");
-
- Console.WriteLine("\n\nPress any key to exit.");
- Console.ReadKey();
-
- // Teardown Library
- Library.Terminate();
- }
- }
-}
\ No newline at end of file
diff --git a/examples/manage/invitations/Program.cs b/examples/manage/invitations/Program.cs
index a6004151..b0101344 100644
--- a/examples/manage/invitations/Program.cs
+++ b/examples/manage/invitations/Program.cs
@@ -2,7 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
@@ -15,12 +14,12 @@ static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
- Library.Initialize();
+ //Library.Initialize();
// OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+ Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
// get projects
var projectResp = await deepgramClient.GetProjects();
diff --git a/examples/manage/keys/Program.cs b/examples/manage/keys/Program.cs
index 755223b3..5b1cab49 100644
--- a/examples/manage/keys/Program.cs
+++ b/examples/manage/keys/Program.cs
@@ -2,9 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
namespace SampleApp
@@ -16,11 +13,9 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
// get projects
var projectResp = await deepgramClient.GetProjects();
diff --git a/examples/manage/members/Program.cs b/examples/manage/members/Program.cs
index 959de963..70af1ed2 100644
--- a/examples/manage/members/Program.cs
+++ b/examples/manage/members/Program.cs
@@ -2,11 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
-using Deepgram.Models.Manage.v1;
-
namespace SampleApp
{
class Program
@@ -18,14 +13,12 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
// Get projects
- var projectResp = deepgramClient.GetProjects();
+ var projectResp = await deepgramClient.GetProjects();
if (projectResp == null)
{
Console.WriteLine("ListProjects failed.");
@@ -33,7 +26,7 @@ static async Task Main(string[] args)
}
string myId = null;
- foreach (var project in projectResp.Result.Projects)
+ foreach (var project in projectResp.Projects)
{
myId = project.ProjectId;
string myName = project.Name;
@@ -42,7 +35,7 @@ static async Task Main(string[] args)
// List members
string delMemberId = null;
- var listResp = deepgramClient.GetMembers(myId);
+ var listResp = await deepgramClient.GetMembers(myId);
if (listResp == null)
{
Console.WriteLine("No members found");
@@ -51,7 +44,7 @@ static async Task Main(string[] args)
{
Console.WriteLine($"\n\n{listResp}\n\n");
- foreach (var member in listResp.Result.Members)
+ foreach (var member in listResp.Members)
{
if (member.Email == DELETE_MEMBER_BY_EMAIL)
{
@@ -71,7 +64,7 @@ static async Task Main(string[] args)
Environment.Exit(1);
}
- var deleteResp = deepgramClient.RemoveMember(myId, delMemberId);
+ var deleteResp = await deepgramClient.RemoveMember(myId, delMemberId);
if (deleteResp == null)
{
Console.WriteLine("\n\nRemoveMember failed.\n\n");
@@ -83,7 +76,7 @@ static async Task Main(string[] args)
}
// List members
- listResp = deepgramClient.GetMembers(myId);
+ listResp = await deepgramClient.GetMembers(myId);
if (listResp == null)
{
Console.WriteLine("\n\nNo members found.\n\n");
diff --git a/examples/manage/projects/Program.cs b/examples/manage/projects/Program.cs
index 3e7a5aa6..cc865b7a 100644
--- a/examples/manage/projects/Program.cs
+++ b/examples/manage/projects/Program.cs
@@ -2,9 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
namespace SampleApp
@@ -18,11 +15,9 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
// get projects
var listResp = await deepgramClient.GetProjects();
diff --git a/examples/manage/scopes/Program.cs b/examples/manage/scopes/Program.cs
index 43c56758..d040e0c3 100644
--- a/examples/manage/scopes/Program.cs
+++ b/examples/manage/scopes/Program.cs
@@ -2,9 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
namespace SampleApp
@@ -18,11 +15,9 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new ManageClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateManageClient();
// get projects
var projectResp = await deepgramClient.GetProjects();
diff --git a/examples/manage/usage/Program.cs b/examples/manage/usage/Program.cs
index 5af7e0f4..2faea68e 100644
--- a/examples/manage/usage/Program.cs
+++ b/examples/manage/usage/Program.cs
@@ -2,9 +2,6 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
namespace SampleApp
@@ -16,10 +13,9 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
+ // create a ManageClient directly (without using the factory method) with a API Key
+ // set using the "DEEPGRAM_API_KEY" environment variable
var deepgramClient = new ManageClient();
// get projects
diff --git a/examples/speech-to-text/rest/factory_example/Bueller-Life-moves-pretty-fast.wav b/examples/speech-to-text/rest/factory_example/Bueller-Life-moves-pretty-fast.wav
deleted file mode 100644
index ca08d921..00000000
Binary files a/examples/speech-to-text/rest/factory_example/Bueller-Life-moves-pretty-fast.wav and /dev/null differ
diff --git a/examples/speech-to-text/rest/factory_example/Factory.csproj b/examples/speech-to-text/rest/factory_example/Factory.csproj
deleted file mode 100644
index 95a1a3cf..00000000
--- a/examples/speech-to-text/rest/factory_example/Factory.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Always
-
-
-
-
diff --git a/examples/speech-to-text/rest/factory_example/Program.cs b/examples/speech-to-text/rest/factory_example/Program.cs
deleted file mode 100644
index f65e4b66..00000000
--- a/examples/speech-to-text/rest/factory_example/Program.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram.Logger;
-using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.PreRecorded.v1;
-
-namespace PreRecorded
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- //Library.Initialize();
- // OR very chatty logging
- Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
-
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var deepgramClient = ClientFactory.CreatePreRecordedClient();
-
- // check to see if the file exists
- if (!File.Exists(@"Bueller-Life-moves-pretty-fast.wav"))
- {
- Console.WriteLine("Error: File 'Bueller-Life-moves-pretty-fast.wav' not found.");
- return;
- }
-
- // increase timeout to a very large value
- CancellationTokenSource cancelToken = new CancellationTokenSource();
- cancelToken.CancelAfter(3600000);
-
- var audioData = File.ReadAllBytes(@"Bueller-Life-moves-pretty-fast.wav");
- var response = await deepgramClient.TranscribeFile(
- audioData,
- new PreRecordedSchema()
- {
- Model = "nova-2",
- Punctuate = true,
- },
- cancelToken);
-
- Console.WriteLine($"\n\n{response}\n\n");
- Console.WriteLine("Press any key to exit...");
- Console.ReadKey();
-
- // Teardown Library
- Library.Terminate();
- }
- }
-}
\ No newline at end of file
diff --git a/examples/speech-to-text/rest/file/Program.cs b/examples/speech-to-text/rest/file/Program.cs
index a47fabf7..2a0da3e2 100644
--- a/examples/speech-to-text/rest/file/Program.cs
+++ b/examples/speech-to-text/rest/file/Program.cs
@@ -2,11 +2,8 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
using Deepgram.Logger;
-using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -20,10 +17,8 @@ static async Task Main(string[] args)
// OR very chatty logging
Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- //DeepgramHttpClientOptions dgOptions = new DeepgramHttpClientOptions(null, "38.104.135.210");
- //var deepgramClient = new PreRecordedClient("", dgOptions);
- var deepgramClient = new PreRecordedClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// check to see if the file exists
if (!File.Exists(@"Bueller-Life-moves-pretty-fast.wav"))
diff --git a/examples/speech-to-text/rest/intent/Program.cs b/examples/speech-to-text/rest/intent/Program.cs
index 1ff4a9d5..37b16021 100644
--- a/examples/speech-to-text/rest/intent/Program.cs
+++ b/examples/speech-to-text/rest/intent/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// check to see if the file exists
if (!File.Exists(@"CallCenterPhoneCall.mp3"))
diff --git a/examples/speech-to-text/rest/sentiment/Program.cs b/examples/speech-to-text/rest/sentiment/Program.cs
index 22016602..489685a5 100644
--- a/examples/speech-to-text/rest/sentiment/Program.cs
+++ b/examples/speech-to-text/rest/sentiment/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// check to see if the file exists
if (!File.Exists(@"CallCenterPhoneCall.mp3"))
diff --git a/examples/speech-to-text/rest/summary/Program.cs b/examples/speech-to-text/rest/summary/Program.cs
index c1fda520..66d6549b 100644
--- a/examples/speech-to-text/rest/summary/Program.cs
+++ b/examples/speech-to-text/rest/summary/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// check to see if the file exists
if (!File.Exists(@"CallCenterPhoneCall.mp3"))
diff --git a/examples/speech-to-text/rest/topic/Program.cs b/examples/speech-to-text/rest/topic/Program.cs
index e50c10a5..8db27637 100644
--- a/examples/speech-to-text/rest/topic/Program.cs
+++ b/examples/speech-to-text/rest/topic/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -16,8 +14,8 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// check to see if the file exists
if (!File.Exists(@"CallCenterPhoneCall.mp3"))
diff --git a/examples/speech-to-text/rest/url/Program.cs b/examples/speech-to-text/rest/url/Program.cs
index 55557ed9..36098205 100644
--- a/examples/speech-to-text/rest/url/Program.cs
+++ b/examples/speech-to-text/rest/url/Program.cs
@@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -14,15 +14,21 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ // create a ListenRESTClient directly (without using the factory method) with a API Key
+ // set using the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = new ListenRESTClient();
+
+ var customOptions = new Dictionary();
+ customOptions["smart_format"] = "true";
var response = await deepgramClient.TranscribeUrl(
new UrlSource("https://dpgr.am/bueller.wav"),
new PreRecordedSchema()
{
Model = "nova-2",
- });
+ },
+ null, // use the default timeout
+ customOptions);
Console.WriteLine(response);
Console.ReadKey();
diff --git a/examples/speech-to-text/websocket/factory_example/Factory.csproj b/examples/speech-to-text/websocket/factory_example/Factory.csproj
deleted file mode 100644
index f7e99529..00000000
--- a/examples/speech-to-text/websocket/factory_example/Factory.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/speech-to-text/websocket/factory_example/Program.cs b/examples/speech-to-text/websocket/factory_example/Program.cs
deleted file mode 100644
index 3c3c8506..00000000
--- a/examples/speech-to-text/websocket/factory_example/Program.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.Live.v1;
-using Deepgram.Logger;
-using Deepgram.Microphone;
-using System.Threading;
-
-namespace SampleApp
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- Deepgram.Library.Initialize();
- // OR very chatty logging
- //Deepgram.Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- Deepgram.Microphone.Library.Initialize();
-
- Console.WriteLine("\n\nPress any key to stop and exit...\n\n\n");
-
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var options = new DeepgramWsClientOptions(null, null, true);
- var liveClient = ClientFactory.CreateLiveClient("", options);
-
- // Subscribe to the EventResponseReceived event
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"\n\n----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- if (e.Channel.Alternatives[0].Transcript.Trim() == "")
- {
- return;
- }
-
- // Console.WriteLine("Transcription received: " + JsonSerializer.Serialize(e.Transcription));
- Console.WriteLine($"----> Speaker: {e.Channel.Alternatives[0].Transcript}");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> { e.Type} received. Error: {e.Message}");
- }));
-
- // Start the connection
- var liveSchema = new LiveSchema()
- {
- Model = "nova-2",
- Encoding = "linear16",
- SampleRate = 16000,
- Punctuate = true,
- SmartFormat = true,
- InterimResults = true,
- UtteranceEnd = "1000",
- VadEvents = true,
- };
- await liveClient.Connect(liveSchema);
-
- // Microphone streaming
- var microphone = new Microphone(liveClient.Send);
- microphone.Start();
-
- // Wait for the user to press a key
- Console.ReadKey();
-
- // Stop the microphone
- microphone.Stop();
-
- // Stop the connection
- await liveClient.Stop();
-
- // Terminate Libraries
- Deepgram.Microphone.Library.Terminate();
- Deepgram.Library.Terminate();
- }
- }
-}
diff --git a/examples/speech-to-text/websocket/file/Program.cs b/examples/speech-to-text/websocket/file/Program.cs
index 0540a75f..04f2609f 100644
--- a/examples/speech-to-text/websocket/file/Program.cs
+++ b/examples/speech-to-text/websocket/file/Program.cs
@@ -2,8 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using Deepgram.Models.Live.v1;
-using Deepgram.Logger;
+using Deepgram.Models.Listen.v1.WebSocket;
namespace SampleApp
{
@@ -14,11 +13,9 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var liveClient = new LiveClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var liveClient = ClientFactory.CreateListenWebSocketClient();
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler((sender, e) =>
diff --git a/examples/speech-to-text/websocket/http/Program.cs b/examples/speech-to-text/websocket/http/Program.cs
index 64783686..e723b4b5 100644
--- a/examples/speech-to-text/websocket/http/Program.cs
+++ b/examples/speech-to-text/websocket/http/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using Deepgram.Models.Live.v1;
-using Deepgram.Logger;
-using System.Net.WebSockets;
+using Deepgram.Models.Listen.v1.WebSocket;
namespace SampleApp
{
@@ -15,8 +13,8 @@ static async Task Main(string[] args)
// Initialize Library with default logging
Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var liveClient = new LiveClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var liveClient = ClientFactory.CreateListenWebSocketClient();
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler((sender, e) =>
@@ -45,7 +43,7 @@ static async Task Main(string[] args)
{
using (Stream receiveStream = await client.GetStreamAsync(url))
{
- while (liveClient.State() == WebSocketState.Open)
+ while (liveClient.IsConnected())
{
byte[] buffer = new byte[2048];
await receiveStream.ReadAsync(buffer, 0, buffer.Length);
diff --git a/examples/speech-to-text/websocket/microphone-new/Program.cs b/examples/speech-to-text/websocket/microphone-new/Program.cs
deleted file mode 100644
index 27f9dbf0..00000000
--- a/examples/speech-to-text/websocket/microphone-new/Program.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.Listen.v1.WebSocket;
-using Deepgram.Logger;
-using Deepgram.Microphone;
-using Microsoft.Extensions.Options;
-
-namespace SampleApp
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- Deepgram.Library.Initialize();
- // OR very chatty logging
- Deepgram.Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- Deepgram.Microphone.Library.Initialize();
-
- Console.WriteLine("\n\nPress any key to stop and exit...\n\n\n");
-
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- DeepgramWsClientOptions options = new DeepgramWsClientOptions(null, null, true);
- options.AutoFlushReplyDelta = 2000;
- var liveClient = new ListenWebSocketClient("", options);
- // OR
- //var liveClient = new LiveClienkt("set your DEEPGRAM_API_KEY here");
-
- // Subscribe to the EventResponseReceived event
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"\n\n----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- if (e.Channel.Alternatives[0].Transcript.Trim() == "")
- {
- return;
- }
-
- // Console.WriteLine("Transcription received: " + JsonSerializer.Serialize(e.Transcription));
- Console.WriteLine($"----> Speaker: {e.Channel.Alternatives[0].Transcript}");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> {e.Type} received");
- }));
- liveClient.Subscribe(new EventHandler((sender, e) =>
- {
- Console.WriteLine($"----> { e.Type} received. Error: {e.Message}");
- }));
-
- // Start the connection
- var liveSchema = new LiveSchema()
- {
- Model = "nova-2",
- Encoding = "linear16",
- SampleRate = 16000,
- Punctuate = true,
- SmartFormat = true,
- InterimResults = true,
- UtteranceEnd = "1000",
- VadEvents = true,
- };
- await liveClient.Connect(liveSchema);
-
- // Microphone streaming
- var microphone = new Microphone(liveClient.Send);
- microphone.Start();
-
- // Wait for the user to press a key
- Console.ReadKey();
-
- // Stop the microphone
- microphone.Stop();
-
- // Stop the connection
- await liveClient.Stop();
-
- // Terminate Libraries
- Deepgram.Microphone.Library.Terminate();
- Deepgram.Library.Terminate();
- }
- }
-}
diff --git a/examples/speech-to-text/websocket/microphone-new/Streaming.csproj b/examples/speech-to-text/websocket/microphone-new/Streaming.csproj
deleted file mode 100644
index f7e99529..00000000
--- a/examples/speech-to-text/websocket/microphone-new/Streaming.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/speech-to-text/websocket/microphone/Program.cs b/examples/speech-to-text/websocket/microphone/Program.cs
index 78e0be9d..09ceda22 100644
--- a/examples/speech-to-text/websocket/microphone/Program.cs
+++ b/examples/speech-to-text/websocket/microphone/Program.cs
@@ -2,12 +2,10 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.Live.v1;
using Deepgram.Logger;
using Deepgram.Microphone;
+using Deepgram.Models.Authenticate.v1;
+using Deepgram.Models.Listen.v1.WebSocket;
namespace SampleApp
{
@@ -19,17 +17,17 @@ static async Task Main(string[] args)
// Normal logging is "Info" level
Deepgram.Library.Initialize();
// OR very chatty logging
- Deepgram.Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+ // Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+
+ // Initialize the microphone library
Deepgram.Microphone.Library.Initialize();
Console.WriteLine("\n\nPress any key to stop and exit...\n\n\n");
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
DeepgramWsClientOptions options = new DeepgramWsClientOptions(null, null, true);
- options.AutoFlushReplyDelta = 2000;
- var liveClient = new LiveClient("", options);
- // OR
- //var liveClient = new LiveClienkt("set your DEEPGRAM_API_KEY here");
+ //options.AutoFlushReplyDelta = 2000; // if your live stream application is like "push to talk".
+ var liveClient = new ListenWebSocketClient("", options);
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler((sender, e) =>
@@ -42,6 +40,7 @@ static async Task Main(string[] args)
}));
liveClient.Subscribe(new EventHandler((sender, e) =>
{
+ Console.WriteLine($"----> {e.Type} received");
if (e.Channel.Alternatives[0].Transcript.Trim() == "")
{
return;
@@ -68,7 +67,7 @@ static async Task Main(string[] args)
}));
liveClient.Subscribe(new EventHandler((sender, e) =>
{
- Console.WriteLine($"----> { e.Type} received. Error: {e.Message}");
+ Console.WriteLine($"----> {e.Type} received. Error: {e.Message}");
}));
// Start the connection
diff --git a/examples/text-to-speech/rest/file/factory_example/Factory.csproj b/examples/text-to-speech/rest/file/factory_example/Factory.csproj
deleted file mode 100644
index 2aafdda4..00000000
--- a/examples/text-to-speech/rest/file/factory_example/Factory.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/text-to-speech/rest/file/factory_example/Program.cs b/examples/text-to-speech/rest/file/factory_example/Program.cs
deleted file mode 100644
index 42bcbc71..00000000
--- a/examples/text-to-speech/rest/file/factory_example/Program.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
-// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
-// SPDX-License-Identifier: MIT
-
-using System.Text.Json;
-
-using Deepgram;
-using Deepgram.Models.Speak.v1;
-using Deepgram.Logger;
-
-namespace SampleApp
-{
- class Program
- {
- static async Task Main(string[] args)
- {
- // Initialize Library with default logging
- // Normal logging is "Info" level
- Library.Initialize();
- // OR very chatty logging
- //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
-
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var deepgramClient = ClientFactory.CreateSpeakClient();
-
- var response = await deepgramClient.ToFile(
- new TextSource("Hello World!"),
- "test.mp3",
- new SpeakSchema()
- {
- Model = "aura-asteria-en",
- });
-
- //Console.WriteLine(response);
- Console.WriteLine(response);
- Console.ReadKey();
-
- // Teardown Library
- Library.Terminate();
- }
- }
-}
\ No newline at end of file
diff --git a/examples/text-to-speech/rest/file/hello-world/Program.cs b/examples/text-to-speech/rest/file/hello-world/Program.cs
index 92d7499a..308fba90 100644
--- a/examples/text-to-speech/rest/file/hello-world/Program.cs
+++ b/examples/text-to-speech/rest/file/hello-world/Program.cs
@@ -2,11 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram;
-using Deepgram.Models.Speak.v1;
-using Deepgram.Logger;
+using Deepgram.Models.Speak.v1.REST;
namespace SampleApp
{
@@ -16,12 +12,10 @@ static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
- //Library.Initialize();
- // OR very chatty logging
- Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+ Library.Initialize();
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new SpeakClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ var deepgramClient = ClientFactory.CreateSpeakRESTClient();
var response = await deepgramClient.ToFile(
new TextSource("Hello World!"),
diff --git a/examples/text-to-speech/rest/file/hello-world/Speak.csproj b/examples/text-to-speech/rest/file/hello-world/Speak.csproj
index 2aafdda4..2fa6dd32 100644
--- a/examples/text-to-speech/rest/file/hello-world/Speak.csproj
+++ b/examples/text-to-speech/rest/file/hello-world/Speak.csproj
@@ -15,5 +15,8 @@
+
+
+
diff --git a/examples/text-to-speech/rest/file/woodchuck/Program.cs b/examples/text-to-speech/rest/file/woodchuck/Program.cs
index b3178517..702d8c13 100644
--- a/examples/text-to-speech/rest/file/woodchuck/Program.cs
+++ b/examples/text-to-speech/rest/file/woodchuck/Program.cs
@@ -2,10 +2,9 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram;
-using Deepgram.Models.Speak.v1;
+using Deepgram.Models.Authenticate.v1;
+using Deepgram.Models.Speak.v1.REST;
+using Microsoft.Extensions.Options;
namespace SampleApp
{
@@ -16,9 +15,13 @@ static async Task Main(string[] args)
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
+ // OR very chatty logging
+ //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
- // Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new SpeakClient();
+ // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ //DeepgramHttpClientOptions options = new DeepgramHttpClientOptions("", "");
+ //var deepgramClient = ClientFactory.CreateSpeakRESTClient("", options);
+ var deepgramClient = ClientFactory.CreateSpeakRESTClient();
var response = await deepgramClient.ToFile(
new TextSource("How much wood could a woodchuck chuck? If a woodchuck could chuck wood? As much wood as a woodchuck could chuck, if a woodchuck could chuck wood."),
diff --git a/examples/text-to-speech/rest/file/woodchuck/Speak.csproj b/examples/text-to-speech/rest/file/woodchuck/Speak.csproj
index 7ca0baee..f1973b1f 100644
--- a/examples/text-to-speech/rest/file/woodchuck/Speak.csproj
+++ b/examples/text-to-speech/rest/file/woodchuck/Speak.csproj
@@ -11,5 +11,8 @@
+
+
+
diff --git a/examples/text-to-speech/websocket/simple/Program.cs b/examples/text-to-speech/websocket/simple/Program.cs
index e852b3d5..2dc3486f 100644
--- a/examples/text-to-speech/websocket/simple/Program.cs
+++ b/examples/text-to-speech/websocket/simple/Program.cs
@@ -15,15 +15,16 @@ static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
- //Library.Initialize();
+ Library.Initialize();
// OR very chatty logging
- Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
+ //Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
Console.WriteLine("\n\nPress any key to stop and exit...\n\n\n");
- // use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
- var clientOptions = new DeepgramWsClientOptions("", "api.beta.deepgram.com");
- var speakClient = ClientFactory.CreateSpeakWebSocketClient("", clientOptions);
+ //// use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
+ //DeepgramWsClientOptions options = new DeepgramWsClientOptions("", "");
+ //var speakClient = ClientFactory.CreateSpeakWebSocketClient("", options);
+ var speakClient = ClientFactory.CreateSpeakWebSocketClient();
// Subscribe to the EventResponseReceived event
speakClient.Subscribe(new EventHandler((sender, e) =>
diff --git a/tests/edge_cases/keepalive/Program.cs b/tests/edge_cases/keepalive/Program.cs
index 9f2ad67e..e60393af 100644
--- a/tests/edge_cases/keepalive/Program.cs
+++ b/tests/edge_cases/keepalive/Program.cs
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT
using Deepgram.Models.Authenticate.v1;
-using Deepgram.Models.Live.v1;
+using Deepgram.Models.Listen.v1.WebSocket;
using Deepgram.Logger;
namespace SampleApp
@@ -22,7 +22,7 @@ static async Task Main(string[] args)
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
DeepgramWsClientOptions options = new DeepgramWsClientOptions(null, null, true);
- var liveClient = new LiveClient("", options);
+ var liveClient = ClientFactory.CreateListenWebSocketClient("", options);
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler((sender, e) =>
@@ -67,9 +67,6 @@ static async Task Main(string[] args)
// Stop the connection
await liveClient.Stop();
- // Dispose the client
- liveClient.Dispose();
-
// Terminate Libraries
Library.Terminate();
}
diff --git a/tests/expected_failures/rest/bad_host/Program.cs b/tests/expected_failures/rest/bad_host/Program.cs
index 91d89e5c..5f9e39c2 100644
--- a/tests/expected_failures/rest/bad_host/Program.cs
+++ b/tests/expected_failures/rest/bad_host/Program.cs
@@ -2,10 +2,8 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
using Deepgram.Logger;
+using Deepgram.Models.Listen.v1.REST;
using Deepgram.Models.Authenticate.v1;
namespace SampleApp
@@ -21,7 +19,7 @@ static async Task Main(string[] args)
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
var clientOptions = new DeepgramHttpClientOptions(null, "http://127.0.0.1");
- var deepgramClient = new PreRecordedClient("", clientOptions);
+ var deepgramClient = ClientFactory.CreateListenRESTClient("", clientOptions);
try
{
@@ -32,7 +30,7 @@ static async Task Main(string[] args)
Model = "nova-2",
});
- Console.WriteLine(JsonSerializer.Serialize(response));
+ Console.WriteLine(response);
}
catch (Exception ex)
{
diff --git a/tests/expected_failures/rest/throw_exception/Program.cs b/tests/expected_failures/rest/throw_exception/Program.cs
index 49d3851f..4d41ad15 100644
--- a/tests/expected_failures/rest/throw_exception/Program.cs
+++ b/tests/expected_failures/rest/throw_exception/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
namespace PreRecorded
{
@@ -17,12 +15,12 @@ static async Task Main(string[] args)
Library.Initialize();
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
try
{
var response = await deepgramClient.TranscribeUrl(
- new UrlSource("https://dpgr.am/bad.wav"),
+ new UrlSource("https://dpgr.am/bad.wav"), // bad URL
new PreRecordedSchema()
{
Model = "nova-2",
diff --git a/tests/expected_failures/rest/trigger_cancel/Program.cs b/tests/expected_failures/rest/trigger_cancel/Program.cs
index 7d16d725..21de16ef 100644
--- a/tests/expected_failures/rest/trigger_cancel/Program.cs
+++ b/tests/expected_failures/rest/trigger_cancel/Program.cs
@@ -2,9 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using System.Text.Json;
-
-using Deepgram.Models.PreRecorded.v1;
+using Deepgram.Models.Listen.v1.REST;
using Deepgram.Logger;
namespace SampleApp
@@ -19,7 +17,7 @@ static async Task Main(string[] args)
//Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var deepgramClient = new PreRecordedClient();
+ var deepgramClient = ClientFactory.CreateListenRESTClient();
// intentionally cancel the request after 250ms
CancellationTokenSource cancelToken = new CancellationTokenSource(250);
diff --git a/tests/expected_failures/websocket/exercise_timeout/Program.cs b/tests/expected_failures/websocket/exercise_timeout/Program.cs
index 0a8a5728..763aa062 100644
--- a/tests/expected_failures/websocket/exercise_timeout/Program.cs
+++ b/tests/expected_failures/websocket/exercise_timeout/Program.cs
@@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
-using Deepgram.Models.Live.v1;
+using Deepgram.Models.Listen.v1.WebSocket;
using Deepgram.Logger;
namespace SampleApp
@@ -17,7 +17,7 @@ static async Task Main(string[] args)
Library.Initialize(LogLevel.Debug); // LogLevel.Default, LogLevel.Debug, LogLevel.Verbose
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
- var liveClient = new LiveClient();
+ var liveClient = ClientFactory.CreateListenWebSocketClient();
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler((sender, e) =>
@@ -62,9 +62,6 @@ static async Task Main(string[] args)
// Stop the connection
await liveClient.Stop();
- // Dispose the client
- liveClient.Dispose();
-
// Terminate Libraries
Deepgram.Library.Terminate();
}