diff --git a/.gitignore b/.gitignore index 743f7e47..5ddc16d5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.user *.userosscache *.sln.docstates +*.bak # Build results [Dd]ebug/ diff --git a/Deepgram.Tests/Fakes/ConcreteRestClient.cs b/Deepgram.Tests/Fakes/ConcreteRestClient.cs index f1fa2748..5c8b7ddb 100644 --- a/Deepgram.Tests/Fakes/ConcreteRestClient.cs +++ b/Deepgram.Tests/Fakes/ConcreteRestClient.cs @@ -1,4 +1,4 @@ -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.Fakes; diff --git a/Deepgram.Tests/GlobalSuppressions.cs b/Deepgram.Tests/GlobalSuppressions.cs index 435078d8..64acd118 100644 --- a/Deepgram.Tests/GlobalSuppressions.cs +++ b/Deepgram.Tests/GlobalSuppressions.cs @@ -6,17 +6,17 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.LiveClientTests.GetBaseUrl_Should_Return_WSS_Protocol_When_DeepgramClientOptions_BaseAddress_Contains_No_Protocol")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.CreateCredentials_Should_Return_OnPremCredentialsResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.GetCredentials_Should_Call_GetAsync_Returning_OnPremCredentialsResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.ListCredentials_Should_Call_GetAsync_Returning_ListOnPremCredentialsResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFile_With_Bytes_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFile_With_Stream_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Bytes_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Stream_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrl_Should_Call_PostAsync_Returning_SyncPrerecordedResponse~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrerecordedResponse_With_CallBack_Parameter~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrerecordedResponse_With_CallBack_Property~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.CreateCredentials_Should_Return_CredentialResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.GetCredentials_Should_Call_GetAsync_Returning_CredentialResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests.ListCredentials_Should_Call_GetAsync_Returning_CredentialsResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFile_With_Bytes_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFile_With_Stream_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Bytes_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeFileCallBack_With_Stream_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrl_Should_Call_PostAsync_Returning_SyncResponse~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncResponse_With_CallBack_Parameter~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests.TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncResponse_With_CallBack_Property~System.Threading.Tasks.Task")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Tests.UnitTests.ClientTests.OnPremClientTests")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Tests.UnitTests.ClientTests.PrerecordedClientTests")] diff --git a/Deepgram.Tests/UnitTests/ClientTests/AbstractRestClientTests.cs b/Deepgram.Tests/UnitTests/ClientTests/AbstractRestClientTests.cs index 571117d3..cd5d6f5e 100644 --- a/Deepgram.Tests/UnitTests/ClientTests/AbstractRestClientTests.cs +++ b/Deepgram.Tests/UnitTests/ClientTests/AbstractRestClientTests.cs @@ -1,7 +1,7 @@ -using Deepgram.DeepgramHttpClient; +using Deepgram.Encapsulations; using Deepgram.Models.Manage.v1; using Deepgram.Models.PreRecorded.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ClientTests; @@ -22,12 +22,12 @@ public void Setup() public void GetAsync_Should_Throws_HttpRequestException_On_UnsuccessfulResponse() { // Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithException(new HttpRequestException()); var client = new ConcreteRestClient(_apiKey, _clientOptions) { _httpClientWrapper = new HttpClientWrapper(httpClient) }; // Act & Assert - client.Invoking(y => y.GetAsync(UriSegments.PROJECTS)) + client.Invoking(y => y.GetAsync(UriSegments.PROJECTS)) .Should().ThrowAsync(); } @@ -35,12 +35,12 @@ public void GetAsync_Should_Throws_HttpRequestException_On_UnsuccessfulResponse( public void GetAsync_Should_Throws_Exception_On_UnsuccessfulResponse() { // Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithException(new Exception()); var client = new ConcreteRestClient(_apiKey, _clientOptions) { _httpClientWrapper = new HttpClientWrapper(httpClient) }; // Act & Assert - client.Invoking(y => y.GetAsync(UriSegments.PROJECTS)) + client.Invoking(y => y.GetAsync(UriSegments.PROJECTS)) .Should().ThrowAsync(); } @@ -49,14 +49,14 @@ public void GetAsync_Should_Throws_Exception_On_UnsuccessfulResponse() public void PostAsync_Which_Handles_HttpContent_Should_Throw_Exception_On_UnsuccessfulResponse() { // Arrange - var response = new AutoFaker().Generate(); + var response = new AutoFaker().Generate(); var httpContent = Substitute.For(); var httpClient = MockHttpClient.CreateHttpClientWithException(new Exception()); var client = new ConcreteRestClient(_apiKey, _clientOptions) { _httpClientWrapper = new HttpClientWrapper(httpClient) }; // Act & Assert - client.Invoking(y => y.PostAsync(UriSegments.PROJECTS, httpContent)) + client.Invoking(y => y.PostAsync(UriSegments.PROJECTS, httpContent)) .Should().ThrowAsync(); } @@ -65,7 +65,7 @@ public void PostAsync_Which_Handles_HttpContent_Should_Throw_Exception_On_Unsucc public void PostAsync_Which_Handles_HttpContent_Should_Throw_HttpRequestException_On_UnsuccessfulResponse() { // Arrange - var response = new AutoFaker().Generate(); + var response = new AutoFaker().Generate(); var httpContent = Substitute.For(); var httpClient = MockHttpClient.CreateHttpClientWithException(new HttpRequestException()); var client = new ConcreteRestClient(_apiKey, _clientOptions) @@ -74,7 +74,7 @@ public void PostAsync_Which_Handles_HttpContent_Should_Throw_HttpRequestExceptio }; // Act & Assert - client.Invoking(y => y.PostAsync(UriSegments.PROJECTS, httpContent)) + client.Invoking(y => y.PostAsync(UriSegments.PROJECTS, httpContent)) .Should().ThrowAsync(); } @@ -83,14 +83,14 @@ public void PostAsync_Which_Handles_HttpContent_Should_Throw_HttpRequestExceptio public void PostAsync_Should_Throw_Exception_On_UnsuccessfulResponse() { // Arrange - var response = new AutoFaker().Generate(); + var response = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithException(new Exception()); var client = new ConcreteRestClient(_apiKey, _clientOptions) { _httpClientWrapper = new HttpClientWrapper(httpClient) }; // Act & Assert client.Invoking(y => - y.PostAsync(UriSegments.PROJECTS, new StringContent(string.Empty))) + y.PostAsync(UriSegments.PROJECTS, new StringContent(string.Empty))) .Should().ThrowAsync(); } @@ -98,14 +98,14 @@ public void PostAsync_Should_Throw_Exception_On_UnsuccessfulResponse() public void PostAsync_Should_Throw_HttpRequestException_On_UnsuccessfulResponse() { // Arrange - var response = new AutoFaker().Generate(); + var response = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithException(new HttpRequestException()); var client = new ConcreteRestClient(_apiKey, _clientOptions) { _httpClientWrapper = new HttpClientWrapper(httpClient) }; // Act & Assert client.Invoking(y => - y.PostAsync(UriSegments.PROJECTS, new StringContent(string.Empty))) + y.PostAsync(UriSegments.PROJECTS, new StringContent(string.Empty))) .Should().ThrowAsync(); } diff --git a/Deepgram.Tests/UnitTests/ClientTests/LiveClientTests.cs b/Deepgram.Tests/UnitTests/ClientTests/LiveClientTests.cs index f41e5c1c..1a6a86d6 100644 --- a/Deepgram.Tests/UnitTests/ClientTests/LiveClientTests.cs +++ b/Deepgram.Tests/UnitTests/ClientTests/LiveClientTests.cs @@ -1,7 +1,7 @@ using System.Net.WebSockets; using Deepgram.DeepgramEventArgs; using Deepgram.Models.Live.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ClientTests; public class LiveClientTests @@ -25,17 +25,17 @@ public void Teardown() { _liveClient.Dispose(); } [Test] - public void ProcessDataReceived_Should_Raise_TranscriptReceived_Event_When_Response_Contains_Type_LiveTranscriptionResponse() + public void ProcessDataReceived_Should_Raise_TranscriptReceived_Event_When_Response_Contains_Type_TranscriptionResponse() { //Arrange - var liveTranscriptionResponse = new AutoFaker().Generate(); + var liveTranscriptionResponse = new AutoFaker().Generate(); // ensure the right type is set for testing liveTranscriptionResponse.Type = Enums.LiveType.Results; var json = JsonSerializer.Serialize(liveTranscriptionResponse); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json)); - LiveResponseReceivedEventArgs? eventArgs = null; + ResponseReceivedEventArgs? eventArgs = null; - _liveClient.LiveResponseReceived += (sender, args) => eventArgs = args; + _liveClient.EventResponseReceived += (sender, args) => eventArgs = args; //Act @@ -45,22 +45,22 @@ public void ProcessDataReceived_Should_Raise_TranscriptReceived_Event_When_Respo eventArgs.Should().NotBeNull(); eventArgs!.Response.Transcription.Should().NotBeNull(); - eventArgs.Response.Transcription.Should().BeAssignableTo(); + eventArgs.Response.Transcription.Should().BeAssignableTo(); } [Test] - public void ProcessDataReceived_Should_Raise_MetaDataReceived_Event_When_Response_Contains_Type_LiveMetadataResponse() + public void ProcessDataReceived_Should_Raise_MetaDataReceived_Event_When_Response_Contains_Type_MetadataResponse() { //Arrange - var liveMetadataResponse = new AutoFaker().Generate(); + var liveMetadataResponse = new AutoFaker().Generate(); // ensure the right type is set for testing liveMetadataResponse.Type = Enums.LiveType.Metadata; var json = JsonSerializer.Serialize(liveMetadataResponse); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json)); - LiveResponseReceivedEventArgs? eventArgs = null; + ResponseReceivedEventArgs? eventArgs = null; - _liveClient.LiveResponseReceived += (sender, args) => eventArgs = args; + _liveClient.EventResponseReceived += (sender, args) => eventArgs = args; //Act _liveClient.ProcessDataReceived(_webSocketReceiveResult, memoryStream); @@ -70,7 +70,7 @@ public void ProcessDataReceived_Should_Raise_MetaDataReceived_Event_When_Respons { eventArgs.Should().NotBeNull(); eventArgs!.Response.MetaData.Should().NotBeNull(); - eventArgs.Response.MetaData.Should().BeAssignableTo(); + eventArgs.Response.MetaData.Should().BeAssignableTo(); } } @@ -82,9 +82,9 @@ public void ProcessDataReceived_Should_Raise_LiveError_Event_When_Response_Conta var json = JsonSerializer.Serialize(unknownDataResponse); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json)); - LiveResponseReceivedEventArgs? eventArgs = null; + ResponseReceivedEventArgs? eventArgs = null; - _liveClient.LiveResponseReceived += (sender, args) => eventArgs = args; + _liveClient.EventResponseReceived += (sender, args) => eventArgs = args; //Act _liveClient.ProcessDataReceived(_webSocketReceiveResult, memoryStream); diff --git a/Deepgram.Tests/UnitTests/ClientTests/ManageClientTest.cs b/Deepgram.Tests/UnitTests/ClientTests/ManageClientTest.cs index 97e3920f..ecb5b686 100644 --- a/Deepgram.Tests/UnitTests/ClientTests/ManageClientTest.cs +++ b/Deepgram.Tests/UnitTests/ClientTests/ManageClientTest.cs @@ -1,7 +1,7 @@ -using Deepgram.DeepgramHttpClient; +using Deepgram.Encapsulations; using Deepgram.Models.Manage; using Deepgram.Models.Manage.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ClientTests; public class ManageClientTest @@ -23,55 +23,55 @@ public void Setup() [Test] - public async Task GetProjects_Should_Call_GetAsync_Returning_GetProjectsResponse() + public async Task GetProjects_Should_Call_GetAsync_Returning_ProjectsResponse() { // Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync(UriSegments.PROJECTS).Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync(UriSegments.PROJECTS).Returns(expectedResponse); // Act var result = await manageClient.GetProjects(); // Assert - await manageClient.Received().GetAsync(UriSegments.PROJECTS); + await manageClient.Received().GetAsync(UriSegments.PROJECTS); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProject_Should_Call_GetAsync_Returning_GetProjectResponse() + public async Task GetProject_Should_Call_GetAsync_Returning_ProjectResponse() { // Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); expectedResponse.ProjectId = _projectId; var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}").Returns(expectedResponse); // Act var result = await manageClient.GetProject(_projectId); // Assert - await manageClient.Received().GetAsync($"projects/{_projectId}"); + await manageClient.Received().GetAsync($"projects/{_projectId}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -81,7 +81,7 @@ public async Task UpdateProject_Should_Call_PatchAsync_Returning_MessageResponse { //Arrange var expectedResponse = new AutoFaker().Generate(); - var updateProjectSchema = new AutoFaker().Generate(); + var updateProjectSchema = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); @@ -150,71 +150,71 @@ public async Task DeleteProject_Should_Call_DeleteAsync() #region ProjectKeys [Test] - public async Task GetProjectKeys_Should_Call_GetAsync_Returning_GetProjectKeysResponse() + public async Task GetProjectKeys_Should_Call_GetAsync_Returning_KeysResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys").Returns(expectedResponse); //Act var result = await manageClient.GetProjectKeys(_projectId); //Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectKey_Should_Call_GetAsync_Returning_GetProjectKeyResponse() + public async Task GetProjectKey_Should_Call_GetAsync_Returning_KeyResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var keyId = new Faker().Random.Guid().ToString(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys/{keyId}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys/{keyId}").Returns(expectedResponse); //Act var result = await manageClient.GetProjectKey(_projectId, keyId); - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys/{keyId}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/keys/{keyId}"); //Assert using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task CreateProjectKey_Should_Call_PostAsync_Returning_CreateProjectKeyResponse_Without_Expiration_TimeToLive_Set() + public async Task CreateProjectKey_Should_Call_PostAsync_Returning_KeyResponse_Without_Expiration_TimeToLive_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var createKeySchema = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); + var createKeySchema = new AutoFaker().Generate(); createKeySchema.ExpirationDate = null; createKeySchema.TimeToLiveInSeconds = null; var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); + manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); @@ -222,29 +222,29 @@ public async Task CreateProjectKey_Should_Call_PostAsync_Returning_CreateProject var result = await manageClient.CreateProjectKey(_projectId, createKeySchema); //Assert - await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); + await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task CreateProjectKey_Should_Call_PostAsync_Returning_CreateProjectKeyResponse_With_Expiration_Set() + public async Task CreateProjectKey_Should_Call_PostAsync_Returning_KeyResponse_With_Expiration_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var createKeySchema = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); + var createKeySchema = new AutoFaker().Generate(); createKeySchema.TimeToLiveInSeconds = null; var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); + manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); @@ -252,40 +252,40 @@ public async Task CreateProjectKey_Should_Call_PostAsync_Returning_CreateProject var result = await manageClient.CreateProjectKey(_projectId, createKeySchema); //Assert - await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); + await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task CreateProjectKey_Should_Return_CreateProjectKeyResponse_Without_TimeToLive_Set() + public async Task CreateProjectKey_Should_Return_KeyResponse_Without_TimeToLive_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var createKeySchema = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); + var createKeySchema = new AutoFaker().Generate(); createKeySchema.ExpirationDate = null; var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); + manageClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()).Returns(expectedResponse); //Act var result = await manageClient.CreateProjectKey(_projectId, createKeySchema); //Assert - await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); + await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/keys", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -294,7 +294,7 @@ public async Task CreateProjectKey_Should_Return_CreateProjectKeyResponse_Withou public async Task CreateProjectKey_Should_Throw_ArgumentException_When_Both_Expiration_And_TimeToLive_Set() { //Arrange - var createKeySchema = new AutoFaker().Generate(); + var createKeySchema = new AutoFaker().Generate(); var manageClient = new ManageClient(_apiKey, _options) { _httpClientWrapper = new HttpClientWrapper(new HttpClient()) }; @@ -327,26 +327,26 @@ public async Task DeleteProjectKey_Should_Call_DeleteAsync() #region ProjectInvites [Test] - public async Task GetProjectInvites_Should_Call_GetAsync_Returning_GetProjectInvitesResponse() + public async Task GetProjectInvites_Should_Call_GetAsync_Returning_InvitesResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/invites").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/invites").Returns(expectedResponse); // Act var result = await manageClient.GetProjectInvites(_projectId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/invites"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/invites"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -356,7 +356,7 @@ public async Task SendProjectInvite_Should_Call_PostAsync_Returning_MessageRespo { //Arrange var expectedResponse = new AutoFaker().Generate(); - var sendProjectInviteSchema = new AutoFaker().Generate(); + var inviteSchema = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); @@ -365,7 +365,7 @@ public async Task SendProjectInvite_Should_Call_PostAsync_Returning_MessageRespo manageClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/invites", Arg.Any()).Returns(expectedResponse); // Act - var result = await manageClient.SendProjectInvite(_projectId, sendProjectInviteSchema); + var result = await manageClient.SendProjectInvite(_projectId, inviteSchema); // Assert await manageClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/invites", Arg.Any()); @@ -400,53 +400,53 @@ public async Task DeleteProjectInvite_Should_Call_DeleteAsync() #region Members [Test] - public async Task GetProjectMembers_Should_Call_GetAsync_Returning_GetProjectMembersResponse() + public async Task GetProjectMembers_Should_Call_GetAsync_Returning_MembersResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members").Returns(expectedResponse); // Act var result = await manageClient.GetProjectMembers(_projectId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectMemberScopes_Should_Call_GetAsync_Returning_GetProjectMemberScopesResponse() + public async Task GetProjectMemberScopes_Should_Call_GetAsync_Returning_MemberScopesResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var memberId = new Faker().Random.Guid().ToString(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes").Returns(expectedResponse); // Act var result = await manageClient.GetProjectMemberScopes(_projectId, memberId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -456,7 +456,7 @@ public async Task UpdateProjectMemberScope_Should_Call_PutAsync_Returning_Messag { //Arrange var expectedResponse = new AutoFaker().Generate(); - var updateProjectMemberScopeSchema = new AutoFaker().Generate(); + var memberScopeSchema = new AutoFaker().Generate(); var memberId = new Faker().Random.Guid().ToString(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); @@ -466,7 +466,7 @@ public async Task UpdateProjectMemberScope_Should_Call_PutAsync_Returning_Messag manageClient.PutAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes", Arg.Any()).Returns(expectedResponse); // Act - var result = await manageClient.UpdateProjectMemberScope(_projectId, memberId, updateProjectMemberScopeSchema); + var result = await manageClient.UpdateProjectMemberScope(_projectId, memberId, memberScopeSchema); // Assert await manageClient.Received().PutAsync($"{UriSegments.PROJECTS}/{_projectId}/members/{memberId}/scopes", Arg.Any()); @@ -501,111 +501,111 @@ public async Task RemoveProjectMember_Should_Call_DeleteAsync() #region Usage [Test] - public async Task GetProjectUsageRequests_Should_Call_GetAsync_Returning_GetProjectUsageRequestsResponse() + public async Task GetProjectUsageRequests_Should_Call_GetAsync_Returning_UsageRequestsResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var getProjectUsageRequestsSchema = new AutoFaker().Generate(); - var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageRequestsSchema); + var expectedResponse = new AutoFaker().Generate(); + var UsageRequestsSchema = new AutoFaker().Generate(); + var stringedOptions = QueryParameterUtil.GetParameters(UsageRequestsSchema); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests?{stringedOptions}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests?{stringedOptions}").Returns(expectedResponse); // Act - var result = await manageClient.GetProjectUsageRequests(_projectId, getProjectUsageRequestsSchema); + var result = await manageClient.GetProjectUsageRequests(_projectId, UsageRequestsSchema); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests?{stringedOptions}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests?{stringedOptions}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectsUsageRequest_Should_Call_GetAsync_Returning_GetProjectUsageRequestResponse() + public async Task GetProjectsUsageRequest_Should_Call_GetAsync_Returning_UsageRequestResponse() { //Arrange var requestId = new Faker().Random.Guid().ToString(); - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests/{requestId}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests/{requestId}").Returns(expectedResponse); // Act var result = await manageClient.GetProjectUsageRequest(_projectId, requestId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests/{requestId}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/requests/{requestId}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectsUsageSummary_Should_Call_GetAsync_Returning_GetProjectUsageSummaryResponse() + public async Task GetProjectsUsageSummary_Should_Call_GetAsync_Returning_UsageSummaryResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var getProjectUsageSummarySchema = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); + var getProjectUsageSummarySchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageSummarySchema); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage?{stringedOptions}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage?{stringedOptions}").Returns(expectedResponse); // Act var result = await manageClient.GetProjectUsageSummary(_projectId, getProjectUsageSummarySchema); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage?{stringedOptions}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage?{stringedOptions}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectUsageFields_Should_GetAsync_Returning_GetProjectUsageSummaryResponse() + public async Task GetProjectUsageFields_Should_GetAsync_Returning_UsageSummaryResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var getProjectUsageFieldsSchema = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); + var getProjectUsageFieldsSchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageFieldsSchema); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage/fields?{stringedOptions}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage/fields?{stringedOptions}").Returns(expectedResponse); // Act var result = await manageClient.GetProjectUsageFields(_projectId, getProjectUsageFieldsSchema); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage/fields?{stringedOptions}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/usage/fields?{stringedOptions}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -615,51 +615,51 @@ public async Task GetProjectUsageFields_Should_GetAsync_Returning_GetProjectUsag #region Balances [Test] - public async Task GetProjectBalances_Should_Call_GetAsync_Returning_GetProjectBalancesResponse() + public async Task GetProjectBalances_Should_Call_GetAsync_Returning_BalancesResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances").Returns(expectedResponse); // Act var result = await manageClient.GetProjectBalances(_projectId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetProjectBalance_Should_Call_GetAsync_Returning_GetProjectBalanceResponse() + public async Task GetProjectBalance_Should_Call_GetAsync_Returning_BalanceResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var manageClient = Substitute.For(_apiKey, _options); manageClient._httpClientWrapper = new HttpClientWrapper(httpClient); var balanceId = new Faker().Random.Guid().ToString(); - manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances/{balanceId}").Returns(expectedResponse); + manageClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + manageClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances/{balanceId}").Returns(expectedResponse); // Act var result = await manageClient.GetProjectBalance(_projectId, balanceId); // Assert - await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances/{balanceId}"); + await manageClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/balances/{balanceId}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } diff --git a/Deepgram.Tests/UnitTests/ClientTests/OnPremClientTests.cs b/Deepgram.Tests/UnitTests/ClientTests/OnPremClientTests.cs index fb19a377..4912a1c4 100644 --- a/Deepgram.Tests/UnitTests/ClientTests/OnPremClientTests.cs +++ b/Deepgram.Tests/UnitTests/ClientTests/OnPremClientTests.cs @@ -1,7 +1,7 @@ -using Deepgram.DeepgramHttpClient; +using Deepgram.Encapsulations; using Deepgram.Models.Manage.v1; using Deepgram.Models.OnPrem.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ClientTests; public class OnPremClientTests @@ -21,54 +21,54 @@ public void Setup() [Test] - public async Task ListCredentials_Should_Call_GetAsync_Returning_ListOnPremCredentialsResponse() + public async Task ListCredentials_Should_Call_GetAsync_Returning_CredentialsResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var onPremClient = Substitute.For(_apiKey, _options); onPremClient._httpClientWrapper = new HttpClientWrapper(httpClient); - onPremClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - onPremClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}").Returns(expectedResponse); + onPremClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + onPremClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}").Returns(expectedResponse); // Act var result = await onPremClient.ListCredentials(_projectId); // Assert - await onPremClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}"); + await onPremClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task GetCredentials_Should_Call_GetAsync_Returning_OnPremCredentialsResponse() + public async Task GetCredentials_Should_Call_GetAsync_Returning_CredentialResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var credentialsId = new Faker().Random.Guid().ToString(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var onPremClient = Substitute.For(_apiKey, _options); onPremClient._httpClientWrapper = new HttpClientWrapper(httpClient); - onPremClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); - onPremClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}/{credentialsId}").Returns(expectedResponse); + onPremClient.When(x => x.GetAsync(Arg.Any())).DoNotCallBase(); + onPremClient.GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}/{credentialsId}").Returns(expectedResponse); // Act var result = await onPremClient.GetCredentials(_projectId, credentialsId); // Assert - await onPremClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}/{credentialsId}"); + await onPremClient.Received().GetAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}/{credentialsId}"); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -102,29 +102,29 @@ public async Task DeleteCredentials_Should_Call_DeleteAsync_Returning_MessageRes [Test] - public async Task CreateCredentials_Should_Return_OnPremCredentialsResponse() + public async Task CreateCredentials_Should_Return_CredentialResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); - var createOnPremCredentialsSchema = new CreateOnPremCredentialsSchema(); + var expectedResponse = new AutoFaker().Generate(); + var createOnPremCredentialsSchema = new CredentialsSchema(); var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var onPremClient = Substitute.For(_apiKey, _options); onPremClient._httpClientWrapper = new HttpClientWrapper(httpClient); - onPremClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - onPremClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}", Arg.Any()).Returns(expectedResponse); + onPremClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + onPremClient.PostAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}", Arg.Any()).Returns(expectedResponse); // Act var result = await onPremClient.CreateCredentials(_projectId, createOnPremCredentialsSchema); // Assert - await onPremClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}", Arg.Any()); + await onPremClient.Received().PostAsync($"{UriSegments.PROJECTS}/{_projectId}/{UriSegments.ONPREM}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } diff --git a/Deepgram.Tests/UnitTests/ClientTests/PrerecordedClientTests.cs b/Deepgram.Tests/UnitTests/ClientTests/PrerecordedClientTests.cs index 6b551e81..c72cb654 100644 --- a/Deepgram.Tests/UnitTests/ClientTests/PrerecordedClientTests.cs +++ b/Deepgram.Tests/UnitTests/ClientTests/PrerecordedClientTests.cs @@ -1,6 +1,6 @@ -using Deepgram.DeepgramHttpClient; +using Deepgram.Encapsulations; using Deepgram.Models.PreRecorded.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ClientTests; public class PrerecordedClientTests @@ -16,10 +16,10 @@ public void Setup() } [Test] - public async Task TranscribeUrl_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeUrl_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); prerecordedSchema.CallBack = null; var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -29,19 +29,19 @@ public async Task TranscribeUrl_Should_Call_PostAsync_Returning_SyncPrerecordedR var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeUrl(source, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -50,7 +50,7 @@ public async Task TranscribeUrl_Should_Call_PostAsync_Returning_SyncPrerecordedR public async Task TranscribeUrl_Should_Throw_ArgumentException_If_CallBack_Not_Null() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var source = new AutoFaker().Generate(); @@ -58,21 +58,21 @@ public async Task TranscribeUrl_Should_Throw_ArgumentException_If_CallBack_Not_N var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act and Assert await prerecordedClient.Invoking(y => y.TranscribeUrl(source, prerecordedSchema)) .Should().ThrowAsync(); - await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); } [Test] - public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrerecordedResponse_With_CallBack_Parameter() + public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncResponse_With_CallBack_Parameter() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var source = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); // prerecordedSchema is not null here as we first need to get the querystring with the callBack included @@ -81,8 +81,8 @@ public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrer var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); var callBackParameter = prerecordedSchema.CallBack; //before we act to test this call with the callBack parameter and not the callBack property we need to null the callBack property prerecordedSchema.CallBack = null; @@ -92,20 +92,20 @@ public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrer var result = await prerecordedClient.TranscribeUrlCallBack(source, callBackParameter, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrerecordedResponse_With_CallBack_Property() + public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncResponse_With_CallBack_Property() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var source = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedQuery = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -113,18 +113,18 @@ public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrer var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeUrlCallBack(source, null, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -133,7 +133,7 @@ public async Task TranscribeUrlCallBack_Should_Call_PostAsync_Returning_SyncPrer public async Task TranscribeUrlCallBack_Should_Throw_ArgumentException_With_CallBack_Property_And_CallBack_Parameter_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var source = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedQuery = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -141,22 +141,22 @@ public async Task TranscribeUrlCallBack_Should_Throw_ArgumentException_With_Call var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); var callBackParameter = prerecordedSchema.CallBack; // Act Assert await prerecordedClient.Invoking(y => y.TranscribeUrlCallBack(source, callBackParameter, prerecordedSchema)) .Should().ThrowAsync(); - await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); + await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); } [Test] public async Task TranscribeUrlCallBack_Should_Throw_ArgumentException_With_No_CallBack_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var source = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); prerecordedSchema.CallBack = null; @@ -165,22 +165,22 @@ public async Task TranscribeUrlCallBack_Should_Throw_ArgumentException_With_No_C var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()).Returns(expectedResponse); // Act Assert await prerecordedClient.Invoking(y => y.TranscribeUrlCallBack(source, null, prerecordedSchema)) .Should().ThrowAsync(); - await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); + await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedQuery}", Arg.Any()); } [Test] - public async Task TranscribeFile_With_Stream_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFile_With_Stream_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); prerecordedSchema.CallBack = null; var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -189,27 +189,27 @@ public async Task TranscribeFile_With_Stream_Should_Call_PostAsync_Returning_Syn var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeFile(source, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeFile_With_Bytes_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFile_With_Bytes_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); prerecordedSchema.CallBack = null; var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -218,27 +218,27 @@ public async Task TranscribeFile_With_Bytes_Should_Call_PostAsync_Returning_Sync var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeFile(source, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var source = GetFakeStream(GetFakeByteArray()); @@ -246,27 +246,27 @@ public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Property_Shou var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeFileCallBack(source, null, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Property_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var source = GetFakeByteArray(); @@ -274,28 +274,28 @@ public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Property_Shoul var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); // Act var result = await prerecordedClient.TranscribeFileCallBack(source, null, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); // prerecordedSchema is not null here as we first need to get the querystring with the callBack included var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -304,8 +304,8 @@ public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Sho var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); var callBack = prerecordedSchema.CallBack; @@ -316,20 +316,20 @@ public async Task TranscribeFileCallBack_With_Stream_With_CallBack_Parameter_Sho var result = await prerecordedClient.TranscribeFileCallBack(source, callBack, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } [Test] - public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncPrerecordedResponse() + public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Should_Call_PostAsync_Returning_SyncResponse() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); // prerecordedSchema is not null here as we first need to get the querystring with the callBack included var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -338,8 +338,8 @@ public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Shou var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); var callBack = prerecordedSchema.CallBack; @@ -350,11 +350,11 @@ public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Shou var result = await prerecordedClient.TranscribeFileCallBack(source, callBack, prerecordedSchema); // Assert - await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.Received().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); using (new AssertionScope()) { result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Should().BeEquivalentTo(expectedResponse); } } @@ -363,7 +363,7 @@ public async Task TranscribeFileCallBack_With_Bytes_With_CallBack_Parameter_Shou public async Task TranscribeFileCallBack_With_Stream_Throw_ArgumentException_With_CallBack_Property_And_CallBack_Parameter_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var source = GetFakeStream(GetFakeByteArray()); @@ -371,8 +371,8 @@ public async Task TranscribeFileCallBack_With_Stream_Throw_ArgumentException_Wit var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); var callBack = prerecordedSchema.CallBack; @@ -380,7 +380,7 @@ public async Task TranscribeFileCallBack_With_Stream_Throw_ArgumentException_Wit await prerecordedClient.Invoking(y => y.TranscribeFileCallBack(source, callBack, prerecordedSchema)) .Should().ThrowAsync(); - await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); } @@ -389,7 +389,7 @@ await prerecordedClient.Invoking(y => y.TranscribeFileCallBack(source, callBack, public async Task TranscribeFileCallBack_With_Bytes_Should_Throw_ArgumentException_With_No_CallBack_Set() { //Arrange - var expectedResponse = new AutoFaker().Generate(); + var expectedResponse = new AutoFaker().Generate(); var prerecordedSchema = new AutoFaker().Generate(); // prerecordedSchema is not null here as we first need to get the querystring with the callBack included var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); @@ -398,15 +398,15 @@ public async Task TranscribeFileCallBack_With_Bytes_Should_Throw_ArgumentExcepti var httpClient = MockHttpClient.CreateHttpClientWithResult(expectedResponse); var prerecordedClient = Substitute.For(_apiKey, _options); prerecordedClient._httpClientWrapper = new HttpClientWrapper(httpClient); - prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); - prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); + prerecordedClient.When(x => x.PostAsync(Arg.Any(), Arg.Any())).DoNotCallBase(); + prerecordedClient.PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()).Returns(expectedResponse); prerecordedSchema.CallBack = null; // Act Assert await prerecordedClient.Invoking(y => y.TranscribeFileCallBack(source, null, prerecordedSchema)) .Should().ThrowAsync(); - await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); + await prerecordedClient.DidNotReceive().PostAsync($"{UriSegments.LISTEN}?{stringedOptions}", Arg.Any()); } private static Stream GetFakeStream(byte[] source) diff --git a/Deepgram.Tests/UnitTests/ExtensionsTests/HttpClientExtensionTests.cs b/Deepgram.Tests/UnitTests/ExtensionsTests/HttpClientExtensionTests.cs index 82697802..6f038e5a 100644 --- a/Deepgram.Tests/UnitTests/ExtensionsTests/HttpClientExtensionTests.cs +++ b/Deepgram.Tests/UnitTests/ExtensionsTests/HttpClientExtensionTests.cs @@ -1,5 +1,5 @@ using Deepgram.Models.Manage.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Tests.UnitTests.ExtensionsTests; public class HttpClientExtensionTests diff --git a/Deepgram.Tests/UnitTests/UtilitiesTests/QueryParameterUtilTests.cs b/Deepgram.Tests/UnitTests/UtilitiesTests/QueryParameterUtilTests.cs index b76bc24f..c59fac01 100644 --- a/Deepgram.Tests/UnitTests/UtilitiesTests/QueryParameterUtilTests.cs +++ b/Deepgram.Tests/UnitTests/UtilitiesTests/QueryParameterUtilTests.cs @@ -116,7 +116,7 @@ public void GetParameters_Should_Return_String_When_Passing_Boolean_Parameter() public void GetParameters_Should_Return_String_When_Passing_DateTime_Parameter() { //Arrange - var options = new AutoFaker().Generate(); + var options = new AutoFaker().Generate(); var time = DateTime.Now; options.ExpirationDate = time; diff --git a/Deepgram/Abstractions/AbstractRestClient.cs b/Deepgram/Abstractions/AbstractRestClient.cs index 9d27d479..8cf9659e 100644 --- a/Deepgram/Abstractions/AbstractRestClient.cs +++ b/Deepgram/Abstractions/AbstractRestClient.cs @@ -1,5 +1,5 @@ -using Deepgram.DeepgramHttpClient; -using Deepgram.Models.Shared.v1; +using Deepgram.Encapsulations; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Abstractions; @@ -22,7 +22,7 @@ public abstract class AbstractRestClient internal AbstractRestClient(string apiKey, DeepgramClientOptions? deepgramClientOptions = null) { deepgramClientOptions ??= new DeepgramClientOptions(); - _httpClientWrapper = DeepgramHttpClientFactory.Create(apiKey, deepgramClientOptions); + _httpClientWrapper = HttpClientFactory.Create(apiKey, deepgramClientOptions); } /// diff --git a/Deepgram/DeepgramEventArgs/LiveResposneReceivedEventArgs.cs b/Deepgram/DeepgramEventArgs/LiveResposneReceivedEventArgs.cs deleted file mode 100644 index 246b572d..00000000 --- a/Deepgram/DeepgramEventArgs/LiveResposneReceivedEventArgs.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Deepgram.Models.Live.v1; - -namespace Deepgram.DeepgramEventArgs -{ - public class LiveResponseReceivedEventArgs(LiveResponse response) : EventArgs - { - public LiveResponse Response { get; set; } = response; - } -} diff --git a/Deepgram/DeepgramHttpClient/DeepgramHttpClientFactory.cs b/Deepgram/Encapsulations/HttpClientFactory.cs similarity index 86% rename from Deepgram/DeepgramHttpClient/DeepgramHttpClientFactory.cs rename to Deepgram/Encapsulations/HttpClientFactory.cs index 55133c0c..da85399f 100644 --- a/Deepgram/DeepgramHttpClient/DeepgramHttpClientFactory.cs +++ b/Deepgram/Encapsulations/HttpClientFactory.cs @@ -1,8 +1,8 @@ using Deepgram.Extensions; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; -namespace Deepgram.DeepgramHttpClient; -internal class DeepgramHttpClientFactory +namespace Deepgram.Encapsulations; +internal class HttpClientFactory { public static HttpClientWrapper Create(string apiKey, DeepgramClientOptions deepgramClientOptions) { diff --git a/Deepgram/DeepgramHttpClient/HttpClientWrapper.cs b/Deepgram/Encapsulations/HttpClientWrapper.cs similarity index 93% rename from Deepgram/DeepgramHttpClient/HttpClientWrapper.cs rename to Deepgram/Encapsulations/HttpClientWrapper.cs index 79804cc0..a18100d6 100644 --- a/Deepgram/DeepgramHttpClient/HttpClientWrapper.cs +++ b/Deepgram/Encapsulations/HttpClientWrapper.cs @@ -1,10 +1,9 @@ -namespace Deepgram.DeepgramHttpClient; +namespace Deepgram.Encapsulations; internal class HttpClientWrapper(HttpClient HttpClient) { internal Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken = default) { - return HttpClient.SendAsync(request, cancellationToken); } diff --git a/Deepgram/EventArgs/ResponseReceivedEventArgs.cs b/Deepgram/EventArgs/ResponseReceivedEventArgs.cs new file mode 100644 index 00000000..f971a0b4 --- /dev/null +++ b/Deepgram/EventArgs/ResponseReceivedEventArgs.cs @@ -0,0 +1,9 @@ +using Deepgram.Models.Live.v1; + +namespace Deepgram.DeepgramEventArgs; + +public class ResponseReceivedEventArgs(EventResponse response) : EventArgs +{ + public EventResponse Response { get; set; } = response; +} + diff --git a/Deepgram/Extensions/ClientWebSocketExtensions.cs b/Deepgram/Extensions/ClientWebSocketExtensions.cs index ecfb27fb..3db60035 100644 --- a/Deepgram/Extensions/ClientWebSocketExtensions.cs +++ b/Deepgram/Extensions/ClientWebSocketExtensions.cs @@ -1,4 +1,4 @@ -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Extensions; public static class ClientWebSocketExtensions diff --git a/Deepgram/Extensions/HttpClientExtensions.cs b/Deepgram/Extensions/HttpClientExtensions.cs index f9b5ed4b..3e060115 100644 --- a/Deepgram/Extensions/HttpClientExtensions.cs +++ b/Deepgram/Extensions/HttpClientExtensions.cs @@ -1,4 +1,4 @@ -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram.Extensions; diff --git a/Deepgram/GlobalSuppressions.cs b/Deepgram/GlobalSuppressions.cs index bd42656b..b9efa119 100644 --- a/Deepgram/GlobalSuppressions.cs +++ b/Deepgram/GlobalSuppressions.cs @@ -8,24 +8,26 @@ [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~F:Deepgram.Constants.AudioEncoding.OggSpeex")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "namespace", Target = "~N:Deepgram.DeepgramEventArgs")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Manage.v1.Config.Diarize")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Manage.v1.GetProjectsUsageSummarySchema.Diarize")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.CreateOnPremCredentialsSchema")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.ListOnPremCredentialsResponse")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.OnPremCredentialsResponse")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.PreRecorded.v1.AsyncPrerecordedResponse")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Manage.v1.UsageSummarySchema.Diarize")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.CredentialsSchema")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.CredentialsResponse")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.OnPrem.v1.CredentialResponse")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.PreRecorded.v1.AsyncResponse")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.PreRecorded.v1.PrerecordedSchema")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.PreRecorded.v1.SyncPrerecordedResponse")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Shared.v1.TranscriptionSchema.Diarize")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Shared.v1.TranscriptionSchema.DiarizeVersion")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.PreRecorded.v1.SyncResponse")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.PreRecorded.v1.TranscriptionSchema.Diarize")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Live.v1.TranscriptionSchema.Diarize")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.PreRecorded.v1.TranscriptionSchema.DiarizeVersion")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "member", Target = "~P:Deepgram.Models.Live.v1.TranscriptionSchema.DiarizeVersion")] [assembly: SuppressMessage("Performance", "SYSLIB1045:Convert to 'GeneratedRegexAttribute'.", Justification = "", Scope = "member", Target = "~M:Deepgram.Utilities.UserAgentUtil.GetInfo~System.String")] [assembly: SuppressMessage("Performance", "SYSLIB1045:Convert to 'GeneratedRegexAttribute'.", Justification = "", Scope = "member", Target = "~M:Deepgram.Extensions.HttpClientExtensions.SetBaseUrl(System.Net.Http.HttpClient,Deepgram.Models.Shared.v1.DeepgramClientOptions)")] [assembly: SuppressMessage("Performance", "SYSLIB1045:Convert to 'GeneratedRegexAttribute'.", Justification = "", Scope = "member", Target = "~M:Deepgram.LiveClient.GetBaseUrl(Deepgram.Models.Shared.v1.DeepgramClientOptions)~System.String")] -[assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "", Scope = "member", Target = "~M:Deepgram.Models.PreRecorded.v1.SyncPrerecordedResponse.SecondsToTimestamp(System.Decimal)~System.String")] +[assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "", Scope = "member", Target = "~M:Deepgram.Models.PreRecorded.v1.SyncResponse.SecondsToTimestamp(System.Decimal)~System.String")] [assembly: SuppressMessage("Spellchecker", "CRRSP09:A misspelled word has been found", Justification = "", Scope = "member", Target = "~F:Deepgram.LiveClient._deepgramClientOptions")] [assembly: SuppressMessage("Spellchecker", "CRRSP09:A misspelled word has been found", Justification = "", Scope = "member", Target = "~M:Deepgram.Extensions.HttpClientExtensions.ConfigureDeepgram(System.Net.Http.HttpClient,System.String,Deepgram.Models.Shared.v1.DeepgramClientOptions)~System.Net.Http.HttpClient")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "namespace", Target = "~N:Deepgram")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "namespace", Target = "~N:Deepgram.DeepgramHttpClient")] -[assembly: SuppressMessage("Spellchecker", "CRRSP09:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.DeepgramHttpClient.DeepgramHttpClientFactory")] -[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.Shared.v1.DeepgramClientOptions")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "namespace", Target = "~N:Deepgram.HttpClient")] +[assembly: SuppressMessage("Spellchecker", "CRRSP09:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.HttpClient.HttpClientFactory")] +[assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.Models.Authenticate.v1.DeepgramClientOptions")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.OnPremClient")] [assembly: SuppressMessage("Spellchecker", "CRRSP08:A misspelled word has been found", Justification = "", Scope = "type", Target = "~T:Deepgram.PrerecordedClient")] diff --git a/Deepgram/LiveClient.cs b/Deepgram/LiveClient.cs index 320c44ca..94e23289 100644 --- a/Deepgram/LiveClient.cs +++ b/Deepgram/LiveClient.cs @@ -1,6 +1,6 @@ using Deepgram.Extensions; using Deepgram.Models.Live.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram; @@ -29,7 +29,7 @@ public LiveClient(string apiKey, DeepgramClientOptions? deepgramClientOptions = /// /// Fires when transcription metadata is received from the Deepgram API /// - public event EventHandler? LiveResponseReceived; + public event EventHandler? EventResponseReceived; #endregion //TODO when a response is received check if it is a transcript(LiveTranscriptionEvent) or metadata (LiveMetadataEvent) response @@ -176,23 +176,23 @@ internal void ProcessDataReceived(WebSocketReceiveResult result, MemoryStream ms { try { - var liveResponse = new LiveResponse(); + var eventResponse = new EventResponse(); var data = JsonDocument.Parse(response); var val = Enum.Parse(typeof(LiveType), data.RootElement.GetProperty("type").GetString()!); switch (val) { case LiveType.Results: - liveResponse.Transcription = data.Deserialize()!; + eventResponse.Transcription = data.Deserialize()!; break; case LiveType.Metadata: - liveResponse.MetaData = data.Deserialize()!; + eventResponse.MetaData = data.Deserialize()!; break; case LiveType.UtteranceEnd: - liveResponse.UtteranceEnd = data.Deserialize()!; + eventResponse.UtteranceEnd = data.Deserialize()!; break; } - LiveResponseReceived?.Invoke(null, new LiveResponseReceivedEventArgs(liveResponse)); + EventResponseReceived?.Invoke(null, new ResponseReceivedEventArgs(eventResponse)); } catch (Exception ex) { @@ -283,7 +283,7 @@ private void ProcessException(string action, Exception ex) Log.SocketDisposed(logger, action, ex); else Log.Exception(logger, action, ex); - LiveResponseReceived?.Invoke(null, new LiveResponseReceivedEventArgs(new LiveResponse() { Error = ex })); + EventResponseReceived?.Invoke(null, new ResponseReceivedEventArgs(new EventResponse() { Error = ex })); } diff --git a/Deepgram/Logger/Log.cs b/Deepgram/Logger/Log.cs index b572226c..a653db9b 100644 --- a/Deepgram/Logger/Log.cs +++ b/Deepgram/Logger/Log.cs @@ -45,5 +45,5 @@ internal static partial class Log EventId = 0018, Level = LogLevel.Error, Message = "Error creating project key both ExpirationDate and TimeToLiveInSeconds are set: `{createProjectKeySchema}`")] - internal static partial void CreateProjectKeyError(this ILogger logger, CreateProjectKeySchema createProjectKeySchema); + internal static partial void CreateProjectKeyError(this ILogger logger, KeySchema createProjectKeySchema); } diff --git a/Deepgram/ManageClient.cs b/Deepgram/ManageClient.cs index 4cbfb9a5..42fa0a9e 100644 --- a/Deepgram/ManageClient.cs +++ b/Deepgram/ManageClient.cs @@ -1,6 +1,6 @@ using Deepgram.Models.Manage; using Deepgram.Models.Manage.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram; @@ -16,26 +16,26 @@ public class ManageClient(string apiKey, DeepgramClientOptions? deepgramClientOp /// /// Gets projects associated to ApiKey /// - /// - public async Task GetProjects(CancellationToken cancellationToken = default) => - await GetAsync(UriSegments.PROJECTS, cancellationToken); + /// + public async Task GetProjects(CancellationToken cancellationToken = default) => + await GetAsync(UriSegments.PROJECTS, cancellationToken); /// /// Gets project associated with project Id /// /// Id of Project - /// - public async Task GetProject(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}", cancellationToken); + /// + public async Task GetProject(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}", cancellationToken); /// /// Update a project associated with the projectID /// /// ID of project - /// for project + /// for project /// // USES PATCH - public async Task UpdateProject(string projectId, UpdateProjectSchema updateProjectSchema, CancellationToken cancellationToken = default) => + public async Task UpdateProject(string projectId, ProjectSchema updateProjectSchema, CancellationToken cancellationToken = default) => await PatchAsync( $"{UriSegments.PROJECTS}/{projectId}", RequestContentUtil.CreatePayload(updateProjectSchema), cancellationToken); @@ -64,26 +64,26 @@ public async Task LeaveProject(string projectId, CancellationTo /// Get the keys associated with the project /// /// Id of project - /// - public async Task GetProjectKeys(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.KEYS}", cancellationToken); + /// + public async Task GetProjectKeys(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.KEYS}", cancellationToken); /// /// Get details of key associated with the key ID /// /// Id of project /// Id of key - /// - public async Task GetProjectKey(string projectId, string keyId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.KEYS}/{keyId}", cancellationToken); + /// + public async Task GetProjectKey(string projectId, string keyId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.KEYS}/{keyId}", cancellationToken); /// /// Create a key in the associated project /// /// Id of project - /// for the key to be created - /// - public async Task CreateProjectKey(string projectId, CreateProjectKeySchema createProjectKeySchema, CancellationToken cancellationToken = default) + /// for the key to be created + /// + public async Task CreateProjectKey(string projectId, KeySchema createProjectKeySchema, CancellationToken cancellationToken = default) { if (createProjectKeySchema.ExpirationDate is not null && createProjectKeySchema.TimeToLiveInSeconds is not null) { @@ -91,7 +91,7 @@ public async Task CreateProjectKey(string projectId, C throw new ArgumentException("Both ExpirationDate and TimeToLiveInSeconds is set. set either one but not both"); } - return await PostAsync( + return await PostAsync( $"{UriSegments.PROJECTS}/{projectId}/keys", RequestContentUtil.CreatePayload(createProjectKeySchema), cancellationToken); } @@ -113,9 +113,9 @@ public async Task DeleteProjectKey(string projectId, string keyId, CancellationT /// Get any invites that are associated with project /// /// Id of project - /// - public async Task GetProjectInvites(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.INVITES}", cancellationToken); + /// + public async Task GetProjectInvites(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.INVITES}", cancellationToken); /// /// Delete a project invite that has been sent @@ -130,12 +130,12 @@ public async Task DeleteProjectInvite(string projectId, string email, Cancellati /// Send a invite to the associated project /// /// Id of project - /// for a invite to project + /// for a invite to project /// - public async Task SendProjectInvite(string projectId, SendProjectInviteSchema sendProjectInviteSchema, CancellationToken cancellationToken = default) => + public async Task SendProjectInvite(string projectId, InviteSchema inviteSchema, CancellationToken cancellationToken = default) => await PostAsync( $"{UriSegments.PROJECTS}/{projectId}/{UriSegments.INVITES}", - RequestContentUtil.CreatePayload(sendProjectInviteSchema), cancellationToken); + RequestContentUtil.CreatePayload(inviteSchema), cancellationToken); #endregion #region Members @@ -143,30 +143,30 @@ await PostAsync( /// Get the members associated with the project /// /// Id of project - /// - public async Task GetProjectMembers(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.MEMBERS}", cancellationToken); + /// + public async Task GetProjectMembers(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.MEMBERS}", cancellationToken); /// /// Get the scopes associated with member /// /// Id of project /// Id of member - /// - public async Task GetProjectMemberScopes(string projectId, string memberId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.MEMBERS}/{memberId}/{UriSegments.SCOPES}", cancellationToken); + /// + public async Task GetProjectMemberScopes(string projectId, string memberId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.MEMBERS}/{memberId}/{UriSegments.SCOPES}", cancellationToken); /// /// Update the scopes fot the member /// /// Id of project /// Id of member - /// updates scope options for member + /// updates scope options for member /// - public async Task UpdateProjectMemberScope(string projectId, string memberId, UpdateProjectMemberScopeSchema updateProjectMemberScopeSchema, CancellationToken cancellationToken = default) => + public async Task UpdateProjectMemberScope(string projectId, string memberId, MemberScopeSchema memberScopeSchema, CancellationToken cancellationToken = default) => await PutAsync( $"{UriSegments.PROJECTS}/{projectId}/{UriSegments.MEMBERS}/{memberId}/{UriSegments.SCOPES}", - RequestContentUtil.CreatePayload(updateProjectMemberScopeSchema), cancellationToken); + RequestContentUtil.CreatePayload(memberScopeSchema), cancellationToken); /// /// Remove member from project, there is no response @@ -184,12 +184,12 @@ public async Task RemoveProjectMember(string projectId, string memberId, Cancell /// Get usage request associated with the project /// /// Id of project - /// Project usage request options - /// - public async Task GetProjectUsageRequests(string projectId, GetProjectUsageRequestsSchema getProjectUsageRequestsSchema, CancellationToken cancellationToken = default) + /// Project usage request options + /// + public async Task GetProjectUsageRequests(string projectId, UsageRequestsSchema UsageRequestsSchema, CancellationToken cancellationToken = default) { - var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageRequestsSchema); - return await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.REQUESTS}?{stringedOptions}", cancellationToken); + var stringedOptions = QueryParameterUtil.GetParameters(UsageRequestsSchema); + return await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.REQUESTS}?{stringedOptions}", cancellationToken); } /// @@ -197,20 +197,20 @@ public async Task GetProjectUsageRequests(strin /// /// Id of project /// Id of request - /// - public async Task GetProjectUsageRequest(string projectId, string requestId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.REQUESTS}/{requestId}", cancellationToken); + /// + public async Task GetProjectUsageRequest(string projectId, string requestId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.REQUESTS}/{requestId}", cancellationToken); /// /// Gets a summary of usage /// /// Id of project - /// Usage summary options - /// - public async Task GetProjectUsageSummary(string projectId, GetProjectsUsageSummarySchema getProjectUsageSummarySchema, CancellationToken cancellationToken = default) + /// Usage summary options + /// + public async Task GetProjectUsageSummary(string projectId, UsageSummarySchema getProjectUsageSummarySchema, CancellationToken cancellationToken = default) { var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageSummarySchema); - return await GetAsync( + return await GetAsync( $"{UriSegments.PROJECTS}/{projectId}/{UriSegments.USAGE}?{stringedOptions}", cancellationToken); } @@ -218,12 +218,12 @@ public async Task GetProjectUsageSummary(string /// Get usage fields /// /// Id of project - /// Project usage request field options - /// - public async Task GetProjectUsageFields(string projectId, GetProjectUsageFieldsSchema getProjectUsageFieldsSchema, CancellationToken cancellationToken = default) + /// Project usage request field options + /// + public async Task GetProjectUsageFields(string projectId, UsageFieldsSchema getProjectUsageFieldsSchema, CancellationToken cancellationToken = default) { var stringedOptions = QueryParameterUtil.GetParameters(getProjectUsageFieldsSchema); - return await GetAsync( + return await GetAsync( $"{UriSegments.PROJECTS}/{projectId}/{UriSegments.USAGE}/fields?{stringedOptions}", cancellationToken); } #endregion @@ -234,17 +234,17 @@ public async Task GetProjectUsageFields(string pr /// Gets a list of balances /// /// Id of project - /// - public async Task GetProjectBalances(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.BALANCES}", cancellationToken); + /// + public async Task GetProjectBalances(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.BALANCES}", cancellationToken); /// /// Get the balance details associated with the balance id /// /// Id of project /// Id of balance - /// - public async Task GetProjectBalance(string projectId, string balanceId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.BALANCES}/{balanceId}", cancellationToken); + /// + public async Task GetProjectBalance(string projectId, string balanceId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.BALANCES}/{balanceId}", cancellationToken); #endregion } diff --git a/Deepgram/Models/Shared/v1/DeepgramClientOptions.cs b/Deepgram/Models/Authenticate/v1/DeepgramClientOptions.cs similarity index 93% rename from Deepgram/Models/Shared/v1/DeepgramClientOptions.cs rename to Deepgram/Models/Authenticate/v1/DeepgramClientOptions.cs index a55d4670..05ddf27c 100644 --- a/Deepgram/Models/Shared/v1/DeepgramClientOptions.cs +++ b/Deepgram/Models/Authenticate/v1/DeepgramClientOptions.cs @@ -1,5 +1,5 @@  -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Authenticate.v1; /// /// Configuration for the Deepgram client diff --git a/Deepgram/Models/Shared/v1/Average.cs b/Deepgram/Models/Live/v1/Average.cs similarity index 83% rename from Deepgram/Models/Shared/v1/Average.cs rename to Deepgram/Models/Live/v1/Average.cs index d281f01a..24080a7a 100644 --- a/Deepgram/Models/Shared/v1/Average.cs +++ b/Deepgram/Models/Live/v1/Average.cs @@ -1,4 +1,4 @@ -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public class Average { diff --git a/Deepgram/Models/Live/v1/LiveResponse.cs b/Deepgram/Models/Live/v1/EventResponse.cs similarity index 69% rename from Deepgram/Models/Live/v1/LiveResponse.cs rename to Deepgram/Models/Live/v1/EventResponse.cs index 7cddd34c..d250a5f0 100644 --- a/Deepgram/Models/Live/v1/LiveResponse.cs +++ b/Deepgram/Models/Live/v1/EventResponse.cs @@ -1,18 +1,18 @@ namespace Deepgram.Models.Live.v1; -public class LiveResponse +public class EventResponse { /// /// MetaData response from the live transcription service /// - public LiveMetadataResponse? MetaData { get; set; } + public MetadataResponse? MetaData { get; set; } /// /// Transcription response from the live transcription service /// - public LiveTranscriptionResponse? Transcription { get; set; } + public TranscriptionResponse? Transcription { get; set; } /// /// UtterancEnd response from the live transcription service /// - public LiveUtteranceEndResponse? UtteranceEnd { get; set; } + public UtteranceEndResponse? UtteranceEnd { get; set; } /// /// Error response from the live transcription service /// diff --git a/Deepgram/Models/Live/v1/Intent.cs b/Deepgram/Models/Live/v1/Intent.cs new file mode 100644 index 00000000..00c8c983 --- /dev/null +++ b/Deepgram/Models/Live/v1/Intent.cs @@ -0,0 +1,18 @@ +namespace Deepgram.Models.Live.v1; + +public record Intent +{ + /// + /// + /// + [JsonPropertyName("intent")] + public string Intention { get; set; } + /// + /// + /// + [JsonPropertyName("confidence_score")] + public double ConfidenceScore { get; set; } +} + + + diff --git a/Deepgram/Models/Live/v1/IntentSegment.cs b/Deepgram/Models/Live/v1/IntentSegment.cs new file mode 100644 index 00000000..c7343fea --- /dev/null +++ b/Deepgram/Models/Live/v1/IntentSegment.cs @@ -0,0 +1,29 @@ +namespace Deepgram.Models.Live.v1; + +public record IntentSegment +{ + /// + /// + /// + [JsonPropertyName("text")] + public string Text { get; set; } + + /// + /// + /// + [JsonPropertyName("start_word")] + public int StartWord { get; set; } + + /// + /// + /// + [JsonPropertyName("end_word")] + public int EndWord { get; set; } + + /// + /// + /// + /// + [JsonPropertyName("intents")] + public IReadOnlyList Intents { get; set; } +} diff --git a/Deepgram/Models/Live/v1/Intents.cs b/Deepgram/Models/Live/v1/Intents.cs new file mode 100644 index 00000000..0d5e476a --- /dev/null +++ b/Deepgram/Models/Live/v1/Intents.cs @@ -0,0 +1,11 @@ +namespace Deepgram.Models.Live.v1; +public record Intents +{ + /// + /// + /// + /// + [JsonPropertyName("segments")] + public IReadOnlyList? Segments { get; set; } + +} diff --git a/Deepgram/Models/Live/v1/LiveSchema.cs b/Deepgram/Models/Live/v1/LiveSchema.cs index a73ada81..1b3a6538 100644 --- a/Deepgram/Models/Live/v1/LiveSchema.cs +++ b/Deepgram/Models/Live/v1/LiveSchema.cs @@ -1,10 +1,190 @@ -using Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; -namespace Deepgram.Models.Live.v1; - -public class LiveSchema : TranscriptionSchema +public class LiveSchema { + /// + /// Number of transcripts to return per request + /// + /// Default is 1 + /// + [JsonPropertyName("alternatives")] + public int? Alternatives { get; set; } + + /// + /// CallBack allows you to have your submitted audio processed asynchronously. + /// + /// default is null + /// + [JsonPropertyName("callback")] + public string? CallBack { get; set; } + + /// + /// Enables callback method + /// + [JsonPropertyName("callback_method")] + public bool? CallbackMethod { get; set; } + + ///// + ///// Optional. A custom intent you want the model to detect within your input audio if present. Submit up to 100. + ///// + //[JsonPropertyName("custom_intent")] + //public string CustomIntent { get; set; } + + ///// + ///// Optional. Sets how the model will interpret strings submitted to the custom_intent param. When "strict", the model will only return intents submitted using the custom_intent param. When "extended", the model will return it's own detected intents in addition those submitted using the custom_intents param. + ///// + //[JsonPropertyName("custom_intent_mode")] + //public string CustomIntentMode { get; set; } + + + /// + /// Diarize recognizes speaker changes and assigns a speaker to each word in the transcript. + /// + /// default is false + /// + [JsonPropertyName("diarize")] + public bool? Diarize { get; set; } + + // + /// + /// default is null, only applies if Diarize is set to true + /// + [JsonPropertyName("diarize_version")] + public string? DiarizeVersion { get; set; } + + /// + /// Deepgram’s Extra Metadata feature allows you to attach arbitrary key-value pairs to your API requests that are attached to the API response for usage in downstream processing. + /// Extra metadata is limited to 2048 characters per key-value pair. + /// + /// + [JsonPropertyName("extra")] + public Dictionary Extra { get; set; } + + + /// + /// Whether to include words like "uh" and "um" in transcription output. + /// + /// + [JsonPropertyName("filler_words")] + public bool? FillerWords { get; set; } + + ///// + ///// Enables intent recognition + ///// + //[JsonPropertyName("intents")] + //public bool? Intents { get; set; } + + /// + /// Keywords can boost or suppress specialized terminology. + /// + /// + [JsonPropertyName("keywords")] + public List? Keywords { get; set; } + + /// + /// Primary spoken language of submitted audio + /// + /// default value is 'en' + /// + [JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// AI model used to process submitted audio + /// + /// + [JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// Multichannel transcribes each channel in submitted audio independently. + /// + /// + [JsonPropertyName("multichannel")] + public bool? MultiChannel { get; set; } + + + /// + /// Profanity Filter looks for recognized profanity and converts it to the nearest recognized + /// non-profane word or removes it from the transcript completely. + /// + /// for use with base model tier only + /// + [JsonPropertyName("profanity_filter")] + public bool? ProfanityFilter { get; set; } + + /// + /// Adds punctuation and capitalization to transcript + /// + /// + [JsonPropertyName("punctuate")] + public bool? Punctuate { get; set; } + + /// + /// Indicates whether to redact sensitive information, replacing redacted content with asterisks (*). Can send multiple instances in query string (for example, redact=pci&redact=numbers). + /// + /// default is List("false") + /// + [JsonPropertyName("redact")] + public List? Redact { get; set; } + + /// + /// Find and Replace searches for terms or phrases in submitted audio and replaces them. + /// + /// default is null + /// + [JsonPropertyName("replace")] + public List? Replace { get; set; } + + /// + /// Search searches for terms or phrases in submitted audio. + /// + /// default is null + /// + [JsonPropertyName("search")] + public List? Search { get; set; } + + ///// + ///// Enables sentiment analysis false by default + ///// + //[JsonPropertyName("sentiment")] + //public bool? Sentiment { get; set; } + + //[JsonPropertyName("sentiment_threshold")] + //public double? SentimentThreshold { get; set; } + + /// + /// Smart Format formats transcripts to improve readability. + /// + /// + [JsonPropertyName("smart_format")] + public bool? SmartFormat { get; set; } + + /// + /// Tagging allows you to label your requests with one or more tags in a list,for the purpose of identification during usage reporting. + /// + /// Default is a null + /// + [JsonPropertyName("tag")] + public List? Tag { get; set; } + + ///// + ///// Level of model you would like to use in your request. + ///// + ///// + //[JsonPropertyName("tier")] + //[Obsolete("Use Model with joint model syntax https://developers.deepgram.com/docs/models-languages-overview")] + //public string? Tier { get; set; } + + /// + /// Version of the model to use. + /// + /// default value is "latest" + /// + [JsonPropertyName("version")] + public string? Version { get; set; } + /// /// Channels allows you to specify the number of independent audio channels your submitted audio contains. /// Used when the Encoding feature is also being used to submit streaming raw audio diff --git a/Deepgram/Models/Live/v1/LiveMetadataResponse.cs b/Deepgram/Models/Live/v1/MetadataResponse.cs similarity index 88% rename from Deepgram/Models/Live/v1/LiveMetadataResponse.cs rename to Deepgram/Models/Live/v1/MetadataResponse.cs index 98a200df..da60e79f 100644 --- a/Deepgram/Models/Live/v1/LiveMetadataResponse.cs +++ b/Deepgram/Models/Live/v1/MetadataResponse.cs @@ -1,8 +1,6 @@ -using Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; -namespace Deepgram.Models.Live.v1; - -public record LiveMetadataResponse +public record MetadataResponse { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Deepgram/Models/Shared/v1/ModelInfo.cs b/Deepgram/Models/Live/v1/ModelInfo.cs similarity index 85% rename from Deepgram/Models/Shared/v1/ModelInfo.cs rename to Deepgram/Models/Live/v1/ModelInfo.cs index 08c03acd..4dfb2acc 100644 --- a/Deepgram/Models/Shared/v1/ModelInfo.cs +++ b/Deepgram/Models/Live/v1/ModelInfo.cs @@ -1,4 +1,4 @@ -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public record ModelInfo { diff --git a/Deepgram/Models/Shared/v1/Segment.cs b/Deepgram/Models/Live/v1/Segment.cs similarity index 91% rename from Deepgram/Models/Shared/v1/Segment.cs rename to Deepgram/Models/Live/v1/Segment.cs index fc44a3b5..a189d668 100644 --- a/Deepgram/Models/Shared/v1/Segment.cs +++ b/Deepgram/Models/Live/v1/Segment.cs @@ -1,4 +1,4 @@ -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public class Segment { diff --git a/Deepgram/Models/Shared/v1/SentimentGroup.cs b/Deepgram/Models/Live/v1/SentimentGroup.cs similarity index 92% rename from Deepgram/Models/Shared/v1/SentimentGroup.cs rename to Deepgram/Models/Live/v1/SentimentGroup.cs index ffe51f7b..4b4e69e9 100644 --- a/Deepgram/Models/Shared/v1/SentimentGroup.cs +++ b/Deepgram/Models/Live/v1/SentimentGroup.cs @@ -1,5 +1,4 @@ - -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public class SentimentGroup { diff --git a/Deepgram/Models/Shared/v1/SentimentInfo.cs b/Deepgram/Models/Live/v1/SentimentInfo.cs similarity index 87% rename from Deepgram/Models/Shared/v1/SentimentInfo.cs rename to Deepgram/Models/Live/v1/SentimentInfo.cs index 08aa3449..e4416389 100644 --- a/Deepgram/Models/Shared/v1/SentimentInfo.cs +++ b/Deepgram/Models/Live/v1/SentimentInfo.cs @@ -1,4 +1,4 @@ -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public class SentimentInfo { diff --git a/Deepgram/Models/Shared/v1/SentimentSegment.cs b/Deepgram/Models/Live/v1/SentimentSegment.cs similarity index 91% rename from Deepgram/Models/Shared/v1/SentimentSegment.cs rename to Deepgram/Models/Live/v1/SentimentSegment.cs index b8c03905..fa6621ff 100644 --- a/Deepgram/Models/Shared/v1/SentimentSegment.cs +++ b/Deepgram/Models/Live/v1/SentimentSegment.cs @@ -1,4 +1,4 @@ -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public class SentimentSegment { diff --git a/Deepgram/Models/Shared/v1/Sentiments.cs b/Deepgram/Models/Live/v1/Sentiments.cs similarity index 92% rename from Deepgram/Models/Shared/v1/Sentiments.cs rename to Deepgram/Models/Live/v1/Sentiments.cs index b6f8a1bb..48b31764 100644 --- a/Deepgram/Models/Shared/v1/Sentiments.cs +++ b/Deepgram/Models/Live/v1/Sentiments.cs @@ -1,5 +1,4 @@ - -namespace Deepgram.Models.Shared.v1; +namespace Deepgram.Models.Live.v1; public record Sentiments { diff --git a/Deepgram/Models/Live/v1/LiveTranscriptionResponse.cs b/Deepgram/Models/Live/v1/TranscriptionResponse.cs similarity index 88% rename from Deepgram/Models/Live/v1/LiveTranscriptionResponse.cs rename to Deepgram/Models/Live/v1/TranscriptionResponse.cs index 27cf1352..15a61951 100644 --- a/Deepgram/Models/Live/v1/LiveTranscriptionResponse.cs +++ b/Deepgram/Models/Live/v1/TranscriptionResponse.cs @@ -1,7 +1,5 @@ -using Deepgram.Models.PreRecorded.v1; - -namespace Deepgram.Models.Live.v1; -public record LiveTranscriptionResponse +namespace Deepgram.Models.Live.v1; +public record TranscriptionResponse { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Deepgram/Models/Live/v1/LiveUtteranceEndResponse.cs b/Deepgram/Models/Live/v1/UtteranceEndResponse.cs similarity index 90% rename from Deepgram/Models/Live/v1/LiveUtteranceEndResponse.cs rename to Deepgram/Models/Live/v1/UtteranceEndResponse.cs index eeda0d24..5707e3f8 100644 --- a/Deepgram/Models/Live/v1/LiveUtteranceEndResponse.cs +++ b/Deepgram/Models/Live/v1/UtteranceEndResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Live.v1; -public class LiveUtteranceEndResponse +public class UtteranceEndResponse { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Deepgram/Models/Manage/v1/GetProjectBalanceResponse.cs b/Deepgram/Models/Manage/v1/BalanceResponse.cs similarity index 94% rename from Deepgram/Models/Manage/v1/GetProjectBalanceResponse.cs rename to Deepgram/Models/Manage/v1/BalanceResponse.cs index 979b3f20..6d64a052 100644 --- a/Deepgram/Models/Manage/v1/GetProjectBalanceResponse.cs +++ b/Deepgram/Models/Manage/v1/BalanceResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectBalanceResponse +public record BalanceResponse { /// /// Balance id diff --git a/Deepgram/Models/Manage/v1/BalancesResponse.cs b/Deepgram/Models/Manage/v1/BalancesResponse.cs new file mode 100644 index 00000000..fc151837 --- /dev/null +++ b/Deepgram/Models/Manage/v1/BalancesResponse.cs @@ -0,0 +1,10 @@ +namespace Deepgram.Models.Manage.v1; + +public record BalancesResponse +{ + /// + /// ReadOnlyList of project balances + /// + [JsonPropertyName("balances")] + public IReadOnlyList? Balances { get; set; } +} diff --git a/Deepgram/Models/Manage/v1/GetProjectBalancesResponse.cs b/Deepgram/Models/Manage/v1/GetProjectBalancesResponse.cs deleted file mode 100644 index 92e38fcc..00000000 --- a/Deepgram/Models/Manage/v1/GetProjectBalancesResponse.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Deepgram.Models.Manage.v1; - -public record GetProjectBalancesResponse -{ - /// - /// ReadOnlyList of project balances - /// - [JsonPropertyName("balances")] - public IReadOnlyList? Balances { get; set; } -} diff --git a/Deepgram/Models/Manage/v1/SendProjectInviteSchema.cs b/Deepgram/Models/Manage/v1/InviteSchema.cs similarity index 84% rename from Deepgram/Models/Manage/v1/SendProjectInviteSchema.cs rename to Deepgram/Models/Manage/v1/InviteSchema.cs index 50b0deb4..c1e018cf 100644 --- a/Deepgram/Models/Manage/v1/SendProjectInviteSchema.cs +++ b/Deepgram/Models/Manage/v1/InviteSchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class SendProjectInviteSchema(string email, string scope) +public class InviteSchema(string email, string scope) { /// /// email of the person being invited diff --git a/Deepgram/Models/Manage/v1/GetProjectInvitesResponse.cs b/Deepgram/Models/Manage/v1/InvitesResponse.cs similarity index 85% rename from Deepgram/Models/Manage/v1/GetProjectInvitesResponse.cs rename to Deepgram/Models/Manage/v1/InvitesResponse.cs index 56e6da46..e57c1f21 100644 --- a/Deepgram/Models/Manage/v1/GetProjectInvitesResponse.cs +++ b/Deepgram/Models/Manage/v1/InvitesResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectInvitesResponse +public record InvitesResponse { /// /// ReadOnlyList of project invites diff --git a/Deepgram/Models/Manage/v1/CreateProjectKeyResponse.cs b/Deepgram/Models/Manage/v1/KeyResponse.cs similarity index 94% rename from Deepgram/Models/Manage/v1/CreateProjectKeyResponse.cs rename to Deepgram/Models/Manage/v1/KeyResponse.cs index e7644a9f..4368416d 100644 --- a/Deepgram/Models/Manage/v1/CreateProjectKeyResponse.cs +++ b/Deepgram/Models/Manage/v1/KeyResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record CreateProjectKeyResponse +public record KeyResponse { /// /// Unique identifier of the Deepgram API key diff --git a/Deepgram/Models/Manage/v1/CreateProjectKeySchema.cs b/Deepgram/Models/Manage/v1/KeySchema.cs similarity index 92% rename from Deepgram/Models/Manage/v1/CreateProjectKeySchema.cs rename to Deepgram/Models/Manage/v1/KeySchema.cs index 9017c299..3c57e2bf 100644 --- a/Deepgram/Models/Manage/v1/CreateProjectKeySchema.cs +++ b/Deepgram/Models/Manage/v1/KeySchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage; -public class CreateProjectKeySchema(string comment, List scopes) +public class KeySchema(string comment, List scopes) { /// diff --git a/Deepgram/Models/Manage/v1/GetProjectKeyResponse.cs b/Deepgram/Models/Manage/v1/KeyScopeResponse.cs similarity index 90% rename from Deepgram/Models/Manage/v1/GetProjectKeyResponse.cs rename to Deepgram/Models/Manage/v1/KeyScopeResponse.cs index 5d5baa1a..8eb1d0fd 100644 --- a/Deepgram/Models/Manage/v1/GetProjectKeyResponse.cs +++ b/Deepgram/Models/Manage/v1/KeyScopeResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectKeyResponse +public record KeyScopeResponse { /// /// member object diff --git a/Deepgram/Models/Manage/v1/GetProjectKeysResponse.cs b/Deepgram/Models/Manage/v1/KeysResponse.cs similarity index 58% rename from Deepgram/Models/Manage/v1/GetProjectKeysResponse.cs rename to Deepgram/Models/Manage/v1/KeysResponse.cs index e7908386..0d94976e 100644 --- a/Deepgram/Models/Manage/v1/GetProjectKeysResponse.cs +++ b/Deepgram/Models/Manage/v1/KeysResponse.cs @@ -1,9 +1,9 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectKeysResponse +public record KeysResponse { /// /// List of Deepgram api keys /// [JsonPropertyName("api_keys")] - public IReadOnlyList? ApiKeys { get; set; } + public IReadOnlyList? ApiKeys { get; set; } } diff --git a/Deepgram/Models/Manage/v1/UpdateProjectMemberScopeSchema.cs b/Deepgram/Models/Manage/v1/MemberScopeSchema.cs similarity index 76% rename from Deepgram/Models/Manage/v1/UpdateProjectMemberScopeSchema.cs rename to Deepgram/Models/Manage/v1/MemberScopeSchema.cs index 1f3a1701..f231ee18 100644 --- a/Deepgram/Models/Manage/v1/UpdateProjectMemberScopeSchema.cs +++ b/Deepgram/Models/Manage/v1/MemberScopeSchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class UpdateProjectMemberScopeSchema(string scope) +public class MemberScopeSchema(string scope) { /// /// Scope to add for member diff --git a/Deepgram/Models/Manage/v1/GetProjectMemberScopesResponse.cs b/Deepgram/Models/Manage/v1/MemberScopesResponse.cs similarity index 82% rename from Deepgram/Models/Manage/v1/GetProjectMemberScopesResponse.cs rename to Deepgram/Models/Manage/v1/MemberScopesResponse.cs index d5356b1b..d55b27e3 100644 --- a/Deepgram/Models/Manage/v1/GetProjectMemberScopesResponse.cs +++ b/Deepgram/Models/Manage/v1/MemberScopesResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectMemberScopesResponse +public record MemberScopesResponse { /// /// Project scopes associated with member diff --git a/Deepgram/Models/Manage/v1/GetProjectMembersResponse.cs b/Deepgram/Models/Manage/v1/MembersResponse.cs similarity index 77% rename from Deepgram/Models/Manage/v1/GetProjectMembersResponse.cs rename to Deepgram/Models/Manage/v1/MembersResponse.cs index 87c78b70..da005cb5 100644 --- a/Deepgram/Models/Manage/v1/GetProjectMembersResponse.cs +++ b/Deepgram/Models/Manage/v1/MembersResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectMembersResponse +public record MembersResponse { [JsonPropertyName("members")] public IReadOnlyList? Members { get; set; } diff --git a/Deepgram/Models/Manage/v1/GetProjectResponse.cs b/Deepgram/Models/Manage/v1/ProjectResponse.cs similarity index 94% rename from Deepgram/Models/Manage/v1/GetProjectResponse.cs rename to Deepgram/Models/Manage/v1/ProjectResponse.cs index 43c34caa..aa91115e 100644 --- a/Deepgram/Models/Manage/v1/GetProjectResponse.cs +++ b/Deepgram/Models/Manage/v1/ProjectResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectResponse +public record ProjectResponse { /// /// Unique identifier of the Deepgram project diff --git a/Deepgram/Models/Manage/v1/UpdateProjectSchema.cs b/Deepgram/Models/Manage/v1/ProjectSchema.cs similarity index 90% rename from Deepgram/Models/Manage/v1/UpdateProjectSchema.cs rename to Deepgram/Models/Manage/v1/ProjectSchema.cs index cd94c8b6..7b6da5f9 100644 --- a/Deepgram/Models/Manage/v1/UpdateProjectSchema.cs +++ b/Deepgram/Models/Manage/v1/ProjectSchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class UpdateProjectSchema +public class ProjectSchema { /// /// Name of Project diff --git a/Deepgram/Models/Manage/v1/GetProjectsResponse.cs b/Deepgram/Models/Manage/v1/ProjectsResponse.cs similarity index 80% rename from Deepgram/Models/Manage/v1/GetProjectsResponse.cs rename to Deepgram/Models/Manage/v1/ProjectsResponse.cs index c976cdac..00cb7669 100644 --- a/Deepgram/Models/Manage/v1/GetProjectsResponse.cs +++ b/Deepgram/Models/Manage/v1/ProjectsResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectsResponse +public record ProjectsResponse { [JsonPropertyName("projects")] public IReadOnlyList? Projects { get; set; } diff --git a/Deepgram/Models/Manage/v1/GetProjectUsageFieldsResponse.cs b/Deepgram/Models/Manage/v1/UsageFieldsResponse.cs similarity index 95% rename from Deepgram/Models/Manage/v1/GetProjectUsageFieldsResponse.cs rename to Deepgram/Models/Manage/v1/UsageFieldsResponse.cs index 5876d2f2..c34a4bc6 100644 --- a/Deepgram/Models/Manage/v1/GetProjectUsageFieldsResponse.cs +++ b/Deepgram/Models/Manage/v1/UsageFieldsResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectUsageFieldsResponse +public record UsageFieldsResponse { /// /// ReadOnlyList of included tags. diff --git a/Deepgram/Models/Manage/v1/GetProjectUsageFieldsSchema.cs b/Deepgram/Models/Manage/v1/UsageFieldsSchema.cs similarity index 93% rename from Deepgram/Models/Manage/v1/GetProjectUsageFieldsSchema.cs rename to Deepgram/Models/Manage/v1/UsageFieldsSchema.cs index 328c1146..849b259b 100644 --- a/Deepgram/Models/Manage/v1/GetProjectUsageFieldsSchema.cs +++ b/Deepgram/Models/Manage/v1/UsageFieldsSchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class GetProjectUsageFieldsSchema +public class UsageFieldsSchema { /// /// Start date of the requested date range. Format is YYYY-MM-DD. If a full timestamp is given, it will be truncated to a day. Dates are UTC. Defaults to the date of your first request. diff --git a/Deepgram/Models/Manage/v1/GetProjectUsageRequestResponse.cs b/Deepgram/Models/Manage/v1/UsageRequestResponse.cs similarity index 96% rename from Deepgram/Models/Manage/v1/GetProjectUsageRequestResponse.cs rename to Deepgram/Models/Manage/v1/UsageRequestResponse.cs index 0208d89f..7b33da70 100644 --- a/Deepgram/Models/Manage/v1/GetProjectUsageRequestResponse.cs +++ b/Deepgram/Models/Manage/v1/UsageRequestResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectUsageRequestResponse +public record UsageRequestResponse { /// /// Identifier of request. diff --git a/Deepgram/Models/Manage/v1/GetProjectsUsageRequestsResponse.cs b/Deepgram/Models/Manage/v1/UsageRequestsResponse.cs similarity index 62% rename from Deepgram/Models/Manage/v1/GetProjectsUsageRequestsResponse.cs rename to Deepgram/Models/Manage/v1/UsageRequestsResponse.cs index 9983cb38..a06f23e9 100644 --- a/Deepgram/Models/Manage/v1/GetProjectsUsageRequestsResponse.cs +++ b/Deepgram/Models/Manage/v1/UsageRequestsResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectUsageRequestsResponse +public record UsageRequestsResponse { [JsonPropertyName("page")] public int? Page { get; set; } @@ -8,5 +8,5 @@ public record GetProjectUsageRequestsResponse public int? Limit { get; set; } [JsonPropertyName("requests")] - public IReadOnlyList? Requests { get; set; } + public IReadOnlyList? Requests { get; set; } } diff --git a/Deepgram/Models/Manage/v1/GetProjectsUsageRequestsSchema.cs b/Deepgram/Models/Manage/v1/UsageRequestsSchema.cs similarity index 96% rename from Deepgram/Models/Manage/v1/GetProjectsUsageRequestsSchema.cs rename to Deepgram/Models/Manage/v1/UsageRequestsSchema.cs index dba7d15d..5dd13af1 100644 --- a/Deepgram/Models/Manage/v1/GetProjectsUsageRequestsSchema.cs +++ b/Deepgram/Models/Manage/v1/UsageRequestsSchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class GetProjectUsageRequestsSchema +public class UsageRequestsSchema { // /// Start date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM. diff --git a/Deepgram/Models/Manage/v1/GetProjectsUsageSummaryResponse.cs b/Deepgram/Models/Manage/v1/UsageSummaryResponse.cs similarity index 94% rename from Deepgram/Models/Manage/v1/GetProjectsUsageSummaryResponse.cs rename to Deepgram/Models/Manage/v1/UsageSummaryResponse.cs index 1d76e014..f85a76e4 100644 --- a/Deepgram/Models/Manage/v1/GetProjectsUsageSummaryResponse.cs +++ b/Deepgram/Models/Manage/v1/UsageSummaryResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public record GetProjectUsageSummaryResponse +public record UsageSummaryResponse { /// /// Start date for included requests. diff --git a/Deepgram/Models/Manage/v1/GetProjectsUsageSummarySchema.cs b/Deepgram/Models/Manage/v1/UsageSummarySchema.cs similarity index 99% rename from Deepgram/Models/Manage/v1/GetProjectsUsageSummarySchema.cs rename to Deepgram/Models/Manage/v1/UsageSummarySchema.cs index 6606a37f..83c3b127 100644 --- a/Deepgram/Models/Manage/v1/GetProjectsUsageSummarySchema.cs +++ b/Deepgram/Models/Manage/v1/UsageSummarySchema.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.Manage.v1; -public class GetProjectsUsageSummarySchema +public class UsageSummarySchema { /// /// List of Accessors, Limits results to the given API key(s) diff --git a/Deepgram/Models/OnPrem/v1/OnPremCredentialsResponse.cs b/Deepgram/Models/OnPrem/v1/CredentialResponse.cs similarity index 85% rename from Deepgram/Models/OnPrem/v1/OnPremCredentialsResponse.cs rename to Deepgram/Models/OnPrem/v1/CredentialResponse.cs index b113209c..c8b99b82 100644 --- a/Deepgram/Models/OnPrem/v1/OnPremCredentialsResponse.cs +++ b/Deepgram/Models/OnPrem/v1/CredentialResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.OnPrem.v1; -public record OnPremCredentialsResponse +public record CredentialResponse { [JsonPropertyName("member")] diff --git a/Deepgram/Models/OnPrem/v1/CredentialsResponse.cs b/Deepgram/Models/OnPrem/v1/CredentialsResponse.cs new file mode 100644 index 00000000..97f9bd3d --- /dev/null +++ b/Deepgram/Models/OnPrem/v1/CredentialsResponse.cs @@ -0,0 +1,6 @@ +namespace Deepgram.Models.OnPrem.v1; +public record CredentialsResponse +{ + [JsonPropertyName("distribution_credentials")] + public IReadOnlyList DistributionCredentials { get; set; } +} diff --git a/Deepgram/Models/OnPrem/v1/CreateOnPremCredentialsSchema.cs b/Deepgram/Models/OnPrem/v1/CredentialsSchema.cs similarity index 91% rename from Deepgram/Models/OnPrem/v1/CreateOnPremCredentialsSchema.cs rename to Deepgram/Models/OnPrem/v1/CredentialsSchema.cs index 635c519b..b53b02a8 100644 --- a/Deepgram/Models/OnPrem/v1/CreateOnPremCredentialsSchema.cs +++ b/Deepgram/Models/OnPrem/v1/CredentialsSchema.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.OnPrem.v1; -public class CreateOnPremCredentialsSchema +public class CredentialsSchema { /// /// comment to credentials diff --git a/Deepgram/Models/OnPrem/v1/ListOnPremCredentialsResponse.cs b/Deepgram/Models/OnPrem/v1/ListOnPremCredentialsResponse.cs deleted file mode 100644 index 4b7e30cf..00000000 --- a/Deepgram/Models/OnPrem/v1/ListOnPremCredentialsResponse.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Deepgram.Models.OnPrem.v1; -public record ListOnPremCredentialsResponse -{ - [JsonPropertyName("distribution_credentials")] - public IReadOnlyList DistributionCredentials { get; set; } -} diff --git a/Deepgram/Models/PreRecorded/v1/Alternative.cs b/Deepgram/Models/PreRecorded/v1/Alternative.cs index 44f4cfd1..e5b5b1c9 100644 --- a/Deepgram/Models/PreRecorded/v1/Alternative.cs +++ b/Deepgram/Models/PreRecorded/v1/Alternative.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Alternative { diff --git a/Deepgram/Models/PreRecorded/v1/AsyncPrerecordedResponse.cs b/Deepgram/Models/PreRecorded/v1/AsyncResponse.cs similarity index 87% rename from Deepgram/Models/PreRecorded/v1/AsyncPrerecordedResponse.cs rename to Deepgram/Models/PreRecorded/v1/AsyncResponse.cs index 7f1ec89c..69e9ec0f 100644 --- a/Deepgram/Models/PreRecorded/v1/AsyncPrerecordedResponse.cs +++ b/Deepgram/Models/PreRecorded/v1/AsyncResponse.cs @@ -1,5 +1,5 @@ namespace Deepgram.Models.PreRecorded.v1; -public record AsyncPrerecordedResponse +public record AsyncResponse { /// /// Id of transcription request returned when diff --git a/Deepgram/Models/PreRecorded/v1/Average.cs b/Deepgram/Models/PreRecorded/v1/Average.cs new file mode 100644 index 00000000..3cbc0768 --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/Average.cs @@ -0,0 +1,10 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public class Average +{ + [JsonPropertyName("sentiment")] + public string? Sentiment { get; set; } + + [JsonPropertyName("sentiment_score")] + public double? SentimentScore { get; set; } +} diff --git a/Deepgram/Models/PreRecorded/v1/Metadata.cs b/Deepgram/Models/PreRecorded/v1/Metadata.cs index 4a23bd94..f3216ffe 100644 --- a/Deepgram/Models/PreRecorded/v1/Metadata.cs +++ b/Deepgram/Models/PreRecorded/v1/Metadata.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Metadata { diff --git a/Deepgram/Models/PreRecorded/v1/ModelInfo.cs b/Deepgram/Models/PreRecorded/v1/ModelInfo.cs new file mode 100644 index 00000000..1f58505e --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/ModelInfo.cs @@ -0,0 +1,13 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public record ModelInfo +{ + [JsonPropertyName("name")] + public string? Name { get; set; } + + [JsonPropertyName("version")] + public string? Version { get; set; } + + [JsonPropertyName("arch")] + public string? Arch { get; set; } +} diff --git a/Deepgram/Models/PreRecorded/v1/Paragraph.cs b/Deepgram/Models/PreRecorded/v1/Paragraph.cs index cda3e3b4..f827baf1 100644 --- a/Deepgram/Models/PreRecorded/v1/Paragraph.cs +++ b/Deepgram/Models/PreRecorded/v1/Paragraph.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Paragraph { diff --git a/Deepgram/Models/PreRecorded/v1/PrerecordedSchema.cs b/Deepgram/Models/PreRecorded/v1/PrerecordedSchema.cs index 4f1b7d9b..8a728762 100644 --- a/Deepgram/Models/PreRecorded/v1/PrerecordedSchema.cs +++ b/Deepgram/Models/PreRecorded/v1/PrerecordedSchema.cs @@ -1,10 +1,190 @@ -using Deepgram.Models.Shared.v1; +namespace Deepgram.Models.PreRecorded.v1; -namespace Deepgram.Models.PreRecorded.v1; - -public class PrerecordedSchema : TranscriptionSchema +public class PrerecordedSchema { + /// + /// Number of transcripts to return per request + /// + /// Default is 1 + /// + [JsonPropertyName("alternatives")] + public int? Alternatives { get; set; } + + /// + /// CallBack allows you to have your submitted audio processed asynchronously. + /// + /// default is null + /// + [JsonPropertyName("callback")] + public string? CallBack { get; set; } + + /// + /// Enables callback method + /// + [JsonPropertyName("callback_method")] + public bool? CallbackMethod { get; set; } + + ///// + ///// Optional. A custom intent you want the model to detect within your input audio if present. Submit up to 100. + ///// + //[JsonPropertyName("custom_intent")] + //public string CustomIntent { get; set; } + + ///// + ///// Optional. Sets how the model will interpret strings submitted to the custom_intent param. When "strict", the model will only return intents submitted using the custom_intent param. When "extended", the model will return it's own detected intents in addition those submitted using the custom_intents param. + ///// + //[JsonPropertyName("custom_intent_mode")] + //public string CustomIntentMode { get; set; } + + + /// + /// Diarize recognizes speaker changes and assigns a speaker to each word in the transcript. + /// + /// default is false + /// + [JsonPropertyName("diarize")] + public bool? Diarize { get; set; } + + // + /// + /// default is null, only applies if Diarize is set to true + /// + [JsonPropertyName("diarize_version")] + public string? DiarizeVersion { get; set; } + + /// + /// Deepgram’s Extra Metadata feature allows you to attach arbitrary key-value pairs to your API requests that are attached to the API response for usage in downstream processing. + /// Extra metadata is limited to 2048 characters per key-value pair. + /// + /// + [JsonPropertyName("extra")] + public Dictionary Extra { get; set; } + + + /// + /// Whether to include words like "uh" and "um" in transcription output. + /// + /// + [JsonPropertyName("filler_words")] + public bool? FillerWords { get; set; } + + ///// + ///// Enables intent recognition + ///// + //[JsonPropertyName("intents")] + //public bool? Intents { get; set; } + + /// + /// Keywords can boost or suppress specialized terminology. + /// + /// + [JsonPropertyName("keywords")] + public List? Keywords { get; set; } + + /// + /// Primary spoken language of submitted audio + /// + /// default value is 'en' + /// + [JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// AI model used to process submitted audio + /// + /// + [JsonPropertyName("model")] + public string? Model { get; set; } + + /// + /// Multichannel transcribes each channel in submitted audio independently. + /// + /// + [JsonPropertyName("multichannel")] + public bool? MultiChannel { get; set; } + + + /// + /// Profanity Filter looks for recognized profanity and converts it to the nearest recognized + /// non-profane word or removes it from the transcript completely. + /// + /// for use with base model tier only + /// + [JsonPropertyName("profanity_filter")] + public bool? ProfanityFilter { get; set; } + + /// + /// Adds punctuation and capitalization to transcript + /// + /// + [JsonPropertyName("punctuate")] + public bool? Punctuate { get; set; } + + /// + /// Indicates whether to redact sensitive information, replacing redacted content with asterisks (*). Can send multiple instances in query string (for example, redact=pci&redact=numbers). + /// + /// default is List("false") + /// + [JsonPropertyName("redact")] + public List? Redact { get; set; } + + /// + /// Find and Replace searches for terms or phrases in submitted audio and replaces them. + /// + /// default is null + /// + [JsonPropertyName("replace")] + public List? Replace { get; set; } + + /// + /// Search searches for terms or phrases in submitted audio. + /// + /// default is null + /// + [JsonPropertyName("search")] + public List? Search { get; set; } + + ///// + ///// Enables sentiment analysis false by default + ///// + //[JsonPropertyName("sentiment")] + //public bool? Sentiment { get; set; } + + //[JsonPropertyName("sentiment_threshold")] + //public double? SentimentThreshold { get; set; } + + /// + /// Smart Format formats transcripts to improve readability. + /// + /// + [JsonPropertyName("smart_format")] + public bool? SmartFormat { get; set; } + + /// + /// Tagging allows you to label your requests with one or more tags in a list,for the purpose of identification during usage reporting. + /// + /// Default is a null + /// + [JsonPropertyName("tag")] + public List? Tag { get; set; } + + ///// + ///// Level of model you would like to use in your request. + ///// + ///// + //[JsonPropertyName("tier")] + //[Obsolete("Use Model with joint model syntax https://developers.deepgram.com/docs/models-languages-overview")] + //public string? Tier { get; set; } + + /// + /// Version of the model to use. + /// + /// default value is "latest" + /// + [JsonPropertyName("version")] + public string? Version { get; set; } + /// /// Entity Detection identifies and extracts key entities from content in submitted audio /// diff --git a/Deepgram/Models/PreRecorded/v1/Results.cs b/Deepgram/Models/PreRecorded/v1/Results.cs index 6acdfed6..d9137f23 100644 --- a/Deepgram/Models/PreRecorded/v1/Results.cs +++ b/Deepgram/Models/PreRecorded/v1/Results.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Results { diff --git a/Deepgram/Models/PreRecorded/v1/Segment.cs b/Deepgram/Models/PreRecorded/v1/Segment.cs new file mode 100644 index 00000000..d91a2f18 --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/Segment.cs @@ -0,0 +1,19 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public class Segment +{ + [JsonPropertyName("text")] + public string Text { get; set; } + + [JsonPropertyName("start_word")] + public int? StartWord { get; set; } + + [JsonPropertyName("end_word")] + public int? EndWord { get; set; } + + [JsonPropertyName("sentiment")] + public string Sentiment { get; set; } + + [JsonPropertyName("sentiment_score")] + public double? SentimentScore { get; set; } +} diff --git a/Deepgram/Models/PreRecorded/v1/Sentence.cs b/Deepgram/Models/PreRecorded/v1/Sentence.cs index 8fabc366..f2dc471a 100644 --- a/Deepgram/Models/PreRecorded/v1/Sentence.cs +++ b/Deepgram/Models/PreRecorded/v1/Sentence.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Sentence { diff --git a/Deepgram/Models/PreRecorded/v1/SentimentGroup.cs b/Deepgram/Models/PreRecorded/v1/SentimentGroup.cs new file mode 100644 index 00000000..5d468ddf --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/SentimentGroup.cs @@ -0,0 +1,30 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public class SentimentGroup +{ + + [JsonPropertyName("sentiment")] + public string Sentiment { get; set; } + + + [JsonPropertyName("sentiment_score")] + public double? SentimentScore { get; set; } + + + [JsonPropertyName("start_time")] + public double? StartTime { get; set; } + + + [JsonPropertyName("end_time")] + public double? EndTime { get; set; } + + + [JsonPropertyName("segments")] + public List Segments { get; } = []; + + + [JsonPropertyName("average")] + public Average Average { get; set; } +} + + diff --git a/Deepgram/Models/PreRecorded/v1/SentimentInfo.cs b/Deepgram/Models/PreRecorded/v1/SentimentInfo.cs new file mode 100644 index 00000000..96ee7301 --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/SentimentInfo.cs @@ -0,0 +1,18 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public class SentimentInfo +{ + + [JsonPropertyName("model_uuid")] + public string ModelUuid { get; set; } + + + [JsonPropertyName("input_tokens")] + public int? InputTokens { get; set; } + + + [JsonPropertyName("output_tokens")] + public int? OutputTokens { get; set; } +} + + diff --git a/Deepgram/Models/PreRecorded/v1/SentimentSegment.cs b/Deepgram/Models/PreRecorded/v1/SentimentSegment.cs new file mode 100644 index 00000000..525f3ca7 --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/SentimentSegment.cs @@ -0,0 +1,26 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public class SentimentSegment +{ + + [JsonPropertyName("sentiment")] + public string Sentiment { get; set; } + + + [JsonPropertyName("confidence")] + public double? Confidence { get; set; } + + + [JsonPropertyName("text")] + public string Text { get; set; } + + + [JsonPropertyName("start_word")] + public int? StartWord { get; set; } + + + [JsonPropertyName("end_word")] + public int? EndWord { get; set; } +} + + diff --git a/Deepgram/Models/PreRecorded/v1/Sentiments.cs b/Deepgram/Models/PreRecorded/v1/Sentiments.cs new file mode 100644 index 00000000..cfaf7b33 --- /dev/null +++ b/Deepgram/Models/PreRecorded/v1/Sentiments.cs @@ -0,0 +1,30 @@ +namespace Deepgram.Models.PreRecorded.v1; + +public record Sentiments +{ + + [JsonPropertyName("sentiment")] + public string Sentiment { get; set; } + + + [JsonPropertyName("sentiment_score")] + public double? SentimentScore { get; set; } + + + [JsonPropertyName("start_time")] + public double? StartTime { get; set; } + + + [JsonPropertyName("end_time")] + public double? EndTime { get; set; } + + + [JsonPropertyName("segments")] + public List Segments { get; } = []; + + + [JsonPropertyName("average")] + public Average Average { get; set; } +} + + diff --git a/Deepgram/Models/PreRecorded/v1/SyncPrerecordedResponse.cs b/Deepgram/Models/PreRecorded/v1/SyncResponse.cs similarity index 98% rename from Deepgram/Models/PreRecorded/v1/SyncPrerecordedResponse.cs rename to Deepgram/Models/PreRecorded/v1/SyncResponse.cs index e5c75c8e..7fc295e9 100644 --- a/Deepgram/Models/PreRecorded/v1/SyncPrerecordedResponse.cs +++ b/Deepgram/Models/PreRecorded/v1/SyncResponse.cs @@ -1,6 +1,6 @@ namespace Deepgram.Models.PreRecorded.v1; -public record SyncPrerecordedResponse +public record SyncResponse { /// /// Metadata of response diff --git a/Deepgram/Models/PreRecorded/v1/Utterance.cs b/Deepgram/Models/PreRecorded/v1/Utterance.cs index d1d79865..6d2a2096 100644 --- a/Deepgram/Models/PreRecorded/v1/Utterance.cs +++ b/Deepgram/Models/PreRecorded/v1/Utterance.cs @@ -1,6 +1,4 @@ -using Deepgram.Models.Shared.v1; - -namespace Deepgram.Models.PreRecorded.v1; +namespace Deepgram.Models.PreRecorded.v1; public record Utterance { diff --git a/Deepgram/Models/Shared/v1/TranscriptionSchema.cs b/Deepgram/Models/Shared/v1/TranscriptionSchema.cs deleted file mode 100644 index a010a87e..00000000 --- a/Deepgram/Models/Shared/v1/TranscriptionSchema.cs +++ /dev/null @@ -1,186 +0,0 @@ -namespace Deepgram.Models.Shared.v1; -public class TranscriptionSchema -{ - - /// - /// Number of transcripts to return per request - /// - /// Default is 1 - /// - [JsonPropertyName("alternatives")] - public int? Alternatives { get; set; } - - /// - /// CallBack allows you to have your submitted audio processed asynchronously. - /// - /// default is null - /// - [JsonPropertyName("callback")] - public string? CallBack { get; set; } - - /// - /// Enables callback method - /// - [JsonPropertyName("callback_method")] - public bool? CallbackMethod { get; set; } - - ///// - ///// Optional. A custom intent you want the model to detect within your input audio if present. Submit up to 100. - ///// - //[JsonPropertyName("custom_intent")] - //public string CustomIntent { get; set; } - - ///// - ///// Optional. Sets how the model will interpret strings submitted to the custom_intent param. When "strict", the model will only return intents submitted using the custom_intent param. When "extended", the model will return it's own detected intents in addition those submitted using the custom_intents param. - ///// - //[JsonPropertyName("custom_intent_mode")] - //public string CustomIntentMode { get; set; } - - - /// - /// Diarize recognizes speaker changes and assigns a speaker to each word in the transcript. - /// - /// default is false - /// - [JsonPropertyName("diarize")] - public bool? Diarize { get; set; } - - // - /// - /// default is null, only applies if Diarize is set to true - /// - [JsonPropertyName("diarize_version")] - public string? DiarizeVersion { get; set; } - - /// - /// Deepgram’s Extra Metadata feature allows you to attach arbitrary key-value pairs to your API requests that are attached to the API response for usage in downstream processing. - /// Extra metadata is limited to 2048 characters per key-value pair. - /// - /// - [JsonPropertyName("extra")] - public Dictionary Extra { get; set; } - - - /// - /// Whether to include words like "uh" and "um" in transcription output. - /// - /// - [JsonPropertyName("filler_words")] - public bool? FillerWords { get; set; } - - ///// - ///// Enables intent recognition - ///// - //[JsonPropertyName("intents")] - //public bool? Intents { get; set; } - - /// - /// Keywords can boost or suppress specialized terminology. - /// - /// - [JsonPropertyName("keywords")] - public List? Keywords { get; set; } - - /// - /// Primary spoken language of submitted audio - /// - /// default value is 'en' - /// - [JsonPropertyName("language")] - public string? Language { get; set; } - - /// - /// AI model used to process submitted audio - /// - /// - [JsonPropertyName("model")] - public string? Model { get; set; } - - /// - /// Multichannel transcribes each channel in submitted audio independently. - /// - /// - [JsonPropertyName("multichannel")] - public bool? MultiChannel { get; set; } - - - /// - /// Profanity Filter looks for recognized profanity and converts it to the nearest recognized - /// non-profane word or removes it from the transcript completely. - /// - /// for use with base model tier only - /// - [JsonPropertyName("profanity_filter")] - public bool? ProfanityFilter { get; set; } - - /// - /// Adds punctuation and capitalization to transcript - /// - /// - [JsonPropertyName("punctuate")] - public bool? Punctuate { get; set; } - - /// - /// Indicates whether to redact sensitive information, replacing redacted content with asterisks (*). Can send multiple instances in query string (for example, redact=pci&redact=numbers). - /// - /// default is List("false") - /// - [JsonPropertyName("redact")] - public List? Redact { get; set; } - - /// - /// Find and Replace searches for terms or phrases in submitted audio and replaces them. - /// - /// default is null - /// - [JsonPropertyName("replace")] - public List? Replace { get; set; } - - /// - /// Search searches for terms or phrases in submitted audio. - /// - /// default is null - /// - [JsonPropertyName("search")] - public List? Search { get; set; } - - ///// - ///// Enables sentiment analysis false by default - ///// - //[JsonPropertyName("sentiment")] - //public bool? Sentiment { get; set; } - - //[JsonPropertyName("sentiment_threshold")] - //public double? SentimentThreshold { get; set; } - - /// - /// Smart Format formats transcripts to improve readability. - /// - /// - [JsonPropertyName("smart_format")] - public bool? SmartFormat { get; set; } - - /// - /// Tagging allows you to label your requests with one or more tags in a list,for the purpose of identification during usage reporting. - /// - /// Default is a null - /// - [JsonPropertyName("tag")] - public List? Tag { get; set; } - - ///// - ///// Level of model you would like to use in your request. - ///// - ///// - //[JsonPropertyName("tier")] - //[Obsolete("Use Model with joint model syntax https://developers.deepgram.com/docs/models-languages-overview")] - //public string? Tier { get; set; } - - /// - /// Version of the model to use. - /// - /// default value is "latest" - /// - [JsonPropertyName("version")] - public string? Version { get; set; } -} diff --git a/Deepgram/OnPremClient.cs b/Deepgram/OnPremClient.cs index 58692dac..81182623 100644 --- a/Deepgram/OnPremClient.cs +++ b/Deepgram/OnPremClient.cs @@ -1,6 +1,6 @@ using Deepgram.Models.Manage.v1; using Deepgram.Models.OnPrem.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram; @@ -18,18 +18,18 @@ public class OnPremClient(string apiKey, DeepgramClientOptions? deepgramClientOp /// get a list of credentials associated with project /// /// Id of project - /// - public async Task ListCredentials(string projectId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.ONPREM}", cancellationToken); + /// + public async Task ListCredentials(string projectId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.ONPREM}", cancellationToken); /// /// Get credentials for the project that is associated with credential ID /// /// Id of project /// Id of credentials - /// - public async Task GetCredentials(string projectId, string credentialsId, CancellationToken cancellationToken = default) => - await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.ONPREM}/{credentialsId}", cancellationToken); + /// + public async Task GetCredentials(string projectId, string credentialsId, CancellationToken cancellationToken = default) => + await GetAsync($"{UriSegments.PROJECTS}/{projectId}/{UriSegments.ONPREM}/{credentialsId}", cancellationToken); /// /// Remove credentials in the project associated with the credentials ID @@ -44,10 +44,10 @@ public async Task DeleteCredentials(string projectId, string cr /// Create credentials for the associated projects /// /// Id of project - /// for credentials to be created - /// - public async Task CreateCredentials(string projectId, CreateOnPremCredentialsSchema createOnPremCredentialsSchema, CancellationToken cancellationToken = default) => - await PostAsync( + /// for credentials to be created + /// + public async Task CreateCredentials(string projectId, CredentialsSchema createOnPremCredentialsSchema, CancellationToken cancellationToken = default) => + await PostAsync( $"{UriSegments.PROJECTS}/{projectId}/{UriSegments.ONPREM}", RequestContentUtil.CreatePayload(createOnPremCredentialsSchema), cancellationToken); diff --git a/Deepgram/PrerecordedClient.cs b/Deepgram/PrerecordedClient.cs index 64d6ae9c..a6ed6b44 100644 --- a/Deepgram/PrerecordedClient.cs +++ b/Deepgram/PrerecordedClient.cs @@ -1,5 +1,5 @@ using Deepgram.Models.PreRecorded.v1; -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram; @@ -18,12 +18,12 @@ public class PrerecordedClient(string apiKey, DeepgramClientOptions? deepgramCli /// /// Url to the file that is to be transcribed /// Options for the transcription - /// - public async Task TranscribeUrl(UrlSource source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeUrl(UrlSource source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyNoCallBack(nameof(TranscribeUrl), prerecordedSchema); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreatePayload(source), cancellationToken); } @@ -32,14 +32,14 @@ public async Task TranscribeUrl(UrlSource source, Prere /// /// file is the form of a byte[] /// Options for the transcription - /// - public async Task TranscribeFile(byte[] source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeFile(byte[] source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyNoCallBack(nameof(TranscribeFile), prerecordedSchema); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var stream = new MemoryStream(); stream.Write(source, 0, source.Length); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreateStreamPayload(stream), cancellationToken); } @@ -49,12 +49,12 @@ public async Task TranscribeFile(byte[] source, Prereco /// /// file is the form of a stream /// Options for the transcription - /// - public async Task TranscribeFile(Stream source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeFile(Stream source, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyNoCallBack(nameof(TranscribeFile), prerecordedSchema); var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreateStreamPayload(source), cancellationToken); } @@ -68,8 +68,8 @@ public async Task TranscribeFile(Stream source, Prereco /// file is the form of a byte[] /// CallBack url /// Options for the transcription - /// - public async Task TranscribeFileCallBack(byte[] source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeFileCallBack(byte[] source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyOneCallBackSet(nameof(TranscribeFileCallBack), callBack, prerecordedSchema); @@ -78,7 +78,7 @@ public async Task TranscribeFileCallBack(byte[] source var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); var stream = new MemoryStream(); stream.Write(source, 0, source.Length); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreateStreamPayload(stream), cancellationToken); } @@ -89,14 +89,14 @@ public async Task TranscribeFileCallBack(byte[] source /// file is the form of a stream /// CallBack url /// Options for the transcription - /// - public async Task TranscribeFileCallBack(Stream source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeFileCallBack(Stream source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyOneCallBackSet(nameof(TranscribeFileCallBack), callBack, prerecordedSchema); if (callBack != null) prerecordedSchema.CallBack = callBack; var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreateStreamPayload(source), cancellationToken); } @@ -107,15 +107,15 @@ public async Task TranscribeFileCallBack(Stream source /// Url to the file that is to be transcribed /// CallBack url /// Options for the transcription - /// - public async Task TranscribeUrlCallBack(UrlSource source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) + /// + public async Task TranscribeUrlCallBack(UrlSource source, string? callBack, PrerecordedSchema? prerecordedSchema, CancellationToken cancellationToken = default) { VerifyOneCallBackSet(nameof(TranscribeUrlCallBack), callBack, prerecordedSchema); if (callBack != null) prerecordedSchema.CallBack = callBack; var stringedOptions = QueryParameterUtil.GetParameters(prerecordedSchema); - return await PostAsync( + return await PostAsync( $"{UriSegments.LISTEN}?{stringedOptions}", RequestContentUtil.CreatePayload(source), cancellationToken); } diff --git a/Deepgram/README.md b/Deepgram/README.md index 951cd9e0..65b4146d 100644 --- a/Deepgram/README.md +++ b/Deepgram/README.md @@ -229,7 +229,7 @@ var deepgramClient = new LiveClient(apiKey); using (var deepgramLive = deepgramClient.CreateLiveTranscriptionClient()) { - deepgramLive.LiveResponseReceived += LiveResponseReceived; + deepgramLive.EventResponseReceived += EventResponseReceived; // Connection opened so start sending audio. async void HandleConnectionOpened(object? sender, ConnectionOpenEventArgs e) @@ -253,7 +253,7 @@ using (var deepgramLive = deepgramClient.CreateLiveTranscriptionClient()) await deepgramLive.FinishAsync(); } - private async void HandleLiveResponseReceived(object? sender, LiveResponseReceivedEventArgs e) + private async void HandleEventResponseReceived(object? sender, ResponseReceivedEventArgs e) { if (e.Response.Error is not null) { @@ -344,7 +344,7 @@ var result = await manageClient.GetProject(projectId); Update a project. ```csharp -var updateProjectSchema = new UpdateProjectSchema() +var updateProjectSchema = new ProjectSchema() { Company = "Acme", Name = "Mega Speech inc" @@ -353,7 +353,7 @@ var result = await manageClient.UpdateProjectAsync(projectid,updateProjectSchema ``` -**UpdateProjectSchema Type** +**ProjectSchema Type** | Property Name | Type | Description | | ------------- | :----- | :------------------------------------------------------: | @@ -423,7 +423,7 @@ var result = await manageClient.CreateProjectKey(projectId,createProjectKeyWithE [See our API reference for more info](https://developers.deepgram.com/reference/create-key). -### CreateProjectKeySchema +### KeySchema | Property | Type | Required | Description | | ------------- | :------- | :--------|:-------------------------------:| | Scopes | List | * | scopes for key | @@ -511,12 +511,12 @@ var result = await manageClient.GetProjectInvitesAsync(projectId); Sends an invitation to the provided email address. ```csharp -var sendProjectInviteSchema = new SendProjectInviteSchema() +var inviteSchema = new InviteSchema() { Email = "awesome@person.com", Scope = "fab" } -var result = manageClient.SendProjectInviteAsync(projectId,sendProjectInviteSchema) +var result = manageClient.SendProjectInviteAsync(projectId,inviteSchema) ``` [See our API reference for more info](https://developers.deepgram.com/reference/send-invites). @@ -541,14 +541,14 @@ Removes the specified invitation from the project. Retrieves all requests associated with the provided projectId based on the provided options. ```csharp -var getProjectUsageRequestsSchema = new GetProjectUsageRequestsSchema () +var UsageRequestsSchema = new UsageRequestsSchema () { Start = DateTime.Now.AddDays(-7); }; -var result = await manageClient.ListAllRequestsAsync(projectId,getProjectUsageRequestsSchema); +var result = await manageClient.ListAllRequestsAsync(projectId,UsageRequestsSchema); ``` -### GetProjectUsageRequestsSchema +### UsageRequestsSchema | Property | Type | Description | | ------------- | :------- | :------------------------------------: | @@ -613,14 +613,14 @@ var result = await manageClient.GetProjectUsageSummaryAsync(projectId,getProject Lists the features, models, tags, languages, and processing method used for requests in the specified project. ```csharp -var getProjectUsageFieldsSchema = new GetProjectUsageFieldsSchema() +var getProjectUsageFieldsSchema = new UsageFieldsSchema() { Start = Datetime.Now } var result = await manageClient.GetProjectUsageFieldsAsync(projectId,getProjectUsageFieldsSchema); ``` -### GetProjectUsageFieldsSchema +### UsageFieldsSchema | Property | Value | Description | | ------------- | :------- | :------------------------------------: | @@ -666,7 +666,7 @@ var result = onPremClient.DeleteCredentialsASync(projectId,credentialsId); ## Create Credentials ```csharp -var createOnPremCredentialsSchema = new CreateOnPremCredentialsSchema() +var createOnPremCredentialsSchema = new CredentialsSchema() { Comment = "my new credentials", Scopes = new List{"team fab"}, @@ -675,7 +675,7 @@ var createOnPremCredentialsSchema = new CreateOnPremCredentialsSchema() var result = onPremClientCreateCredentialsAsync(string projectId, createOnPremCredentialsSchema) ``` -### CreateOnPremCredentialsSchema +### CredentialsSchema | Property | Value | Description | | ------------- | :------- | :------------------------------------: | diff --git a/Deepgram/ReadClient.cs b/Deepgram/ReadClient.cs index 25440b21..d7306ee4 100644 --- a/Deepgram/ReadClient.cs +++ b/Deepgram/ReadClient.cs @@ -1,4 +1,4 @@ -using Deepgram.Models.Shared.v1; +using Deepgram.Models.Authenticate.v1; namespace Deepgram; diff --git a/Deepgram/TodoAndChanges.md b/Deepgram/TodoAndChanges.md index 6ab73cd9..693a7861 100644 --- a/Deepgram/TodoAndChanges.md +++ b/Deepgram/TodoAndChanges.md @@ -3,8 +3,8 @@ ## Deepgram - Live client change event args to callback - Live client - when receiving data type of data needs to be check currently the - recieve method only expects to recieve LiveTranscriptionResponse but the method - can recieve either LiveTranscriptionResponse or LiveMetadataResponse + recieve method only expects to recieve TranscriptionResponse but the method + can recieve either TranscriptionResponse or MetadataResponse diff --git a/README.md b/README.md index f5888acf..e1dfd728 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,7 @@ var result = await manageClient.GetProject(projectId); Update a project. ```csharp -var updateProjectSchema = new UpdateProjectSchema() +var updateProjectSchema = new ProjectSchema() { Company = "Acme", Name = "Mega Speech inc" @@ -344,7 +344,7 @@ var result = await manageClient.UpdateProjectAsync(projectid,updateProjectSchema ``` -**UpdateProjectSchema Type** +**ProjectSchema Type** | Property Name | Type | Description | | ------------- | :----- | :------------------------------------------------------: | @@ -414,7 +414,7 @@ var result = await manageClient.CreateProjectKey(projectId,createProjectKeyWithE [See our API reference for more info](https://developers.deepgram.com/reference/create-key). -#### CreateProjectKeySchema +#### KeySchema | Property | Type | Required | Description | | ------------- | :------- | :--------|:-------------------------------:| | Scopes | List | * | scopes for key | @@ -502,12 +502,12 @@ var result = await manageClient.GetProjectInvitesAsync(projectId); Sends an invitation to the provided email address. ```csharp -var sendProjectInviteSchema = new SendProjectInviteSchema() +var inviteSchema = new InviteSchema() { Email = "awesome@person.com", Scope = "fab" } -var result = manageClient.SendProjectInviteAsync(projectId,sendProjectInviteSchema) +var result = manageClient.SendProjectInviteAsync(projectId,inviteSchema) ``` [See our API reference for more info](https://developers.deepgram.com/reference/send-invites). @@ -532,14 +532,14 @@ Removes the specified invitation from the project. Retrieves all requests associated with the provided projectId based on the provided options. ```csharp -var getProjectUsageRequestsSchema = new GetProjectUsageRequestsSchema () +var UsageRequestsSchema = new UsageRequestsSchema () { Start = DateTime.Now.AddDays(-7); }; -var result = await manageClient.ListAllRequestsAsync(projectId,getProjectUsageRequestsSchema); +var result = await manageClient.ListAllRequestsAsync(projectId,UsageRequestsSchema); ``` -#### GetProjectUsageRequestsSchema +#### UsageRequestsSchema | Property | Type | Description | | ------------- | :------- | :------------------------------------: | @@ -604,14 +604,14 @@ var result = await manageClient.GetProjectUsageSummaryAsync(projectId,getProject Lists the features, models, tags, languages, and processing method used for requests in the specified project. ```csharp -var getProjectUsageFieldsSchema = new GetProjectUsageFieldsSchema() +var getProjectUsageFieldsSchema = new UsageFieldsSchema() { Start = Datetime.Now } var result = await manageClient.GetProjectUsageFieldsAsync(projectId,getProjectUsageFieldsSchema); ``` -#### GetProjectUsageFieldsSchema +#### UsageFieldsSchema | Property | Value | Description | | ------------- | :------- | :------------------------------------: | @@ -657,7 +657,7 @@ var result = onPremClient.DeleteCredentialsASync(projectId,credentialsId); ## Create Credentials ```csharp -var createOnPremCredentialsSchema = new CreateOnPremCredentialsSchema() +var createOnPremCredentialsSchema = new CredentialsSchema() { Comment = "my new credentials", Scopes = new List{"team fab"}, @@ -666,7 +666,7 @@ var createOnPremCredentialsSchema = new CreateOnPremCredentialsSchema() var result = onPremClientCreateCredentialsAsync(string projectId, createOnPremCredentialsSchema) ``` -#### CreateOnPremCredentialsSchema +#### CredentialsSchema | Property | Value | Description | | ------------- | :------- | :------------------------------------: |