diff --git a/Vonage.Test/ApplicationTests.cs b/Vonage.Test/ApplicationTests.cs index 8d54e9332..a8e8a2f6e 100644 --- a/Vonage.Test/ApplicationTests.cs +++ b/Vonage.Test/ApplicationTests.cs @@ -17,102 +17,6 @@ public class ApplicationTests : TestBase { private const string PublicKey = "some public key"; - [Theory] - [InlineData(false)] - [InlineData(true)] - public void CreateApplication(bool passCreds) - { - var expectedResponseContent = this.GetResponseJson(); - var expectedRequestContent = this.GetRequestJson(); - this.Setup($"{this.ApiUrl}/v2/applications", expectedResponseContent, expectedRequestContent); - var messagesWebhooks = new Dictionary - { - { - Webhook.Type.InboundUrl, - new Webhook {Address = "https://example.com/webhooks/inbound", Method = "POST"} - }, - { - Webhook.Type.StatusUrl, - new Webhook {Address = "https://example.com/webhooks/status", Method = "POST"} - }, - }; - var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks); - var rtcWebhooks = new Dictionary - { - {Webhook.Type.EventUrl, new Webhook {Address = "https://example.com/webhooks/events", Method = "POST"}}, - }; - var rtcCapability = new Rtc(rtcWebhooks); - var voiceWebhooks = new Dictionary - { - { - VoiceWebhookType.AnswerUrl, - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get) - }, - { - VoiceWebhookType.EventUrl, - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/events"), - HttpMethod.Post) - }, - { - VoiceWebhookType.FallbackAnswerUrl, - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get) - }, - }; - var voiceCapability = new Applications.Capabilities.Voice - { - Region = "eu-west", - SignedCallbacks = true, - ConversationsTimeToLive = 12, - Webhooks = voiceWebhooks, - }; - var vbcCapability = new Vbc(); - var capabilities = new ApplicationCapabilities - { - Messages = messagesCapability, Rtc = rtcCapability, Voice = voiceCapability, Vbc = vbcCapability, - }; - var keys = new Keys - { - PublicKey = PublicKey, - }; - var request = new CreateApplicationRequest - { - Capabilities = capabilities, - Keys = keys, - Name = "My Application", - }; - var credentials = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); - var client = this.BuildVonageClient(credentials); - var response = passCreds - ? client.ApplicationClient.CreateApplicaiton(request) - : client.ApplicationClient.CreateApplicaiton(request, credentials); - Assert.Equal("78d335fa323d01149c3dd6f0d48968cf", response.Id); - Assert.True(response.Capabilities.Voice.SignedCallbacks); - Assert.Equal(12, response.Capabilities.Voice.ConversationsTimeToLive); - Assert.Equal("eu-west", response.Capabilities.Voice.Region); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get), response.Capabilities.Voice.Webhooks[VoiceWebhookType.AnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get), - response.Capabilities.Voice.Webhooks[VoiceWebhookType.FallbackAnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/event"), - HttpMethod.Post), response.Capabilities.Voice.Webhooks[VoiceWebhookType.EventUrl]); - Assert.Equal("https://example.com/webhooks/inbound", - response.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Address); - Assert.Equal("POST", response.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Method); - Assert.Equal("https://example.com/webhooks/status", - response.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Address); - Assert.Equal("POST", response.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Method); - Assert.Equal("https://example.com/webhooks/event", - response.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Address); - Assert.Equal("POST", response.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Method); - Assert.Equal("My Application", response.Name); - } - [Theory] [InlineData(false)] [InlineData(true)] @@ -226,11 +130,11 @@ public async Task CreateApplicationAsync(bool passCreds) Application response; if (passCreds) { - response = await client.ApplicationClient.CreateApplicaitonAsync(request); + response = await client.ApplicationClient.CreateApplicationAsync(request); } else { - response = await client.ApplicationClient.CreateApplicaitonAsync(request, creds); + response = await client.ApplicationClient.CreateApplicationAsync(request, creds); } Assert.Equal("78d335fa323d01149c3dd6f0d48968cf", response.Id); @@ -274,7 +178,7 @@ public async Task CreateApplicationAsyncWithPrivacySettings() }; var credentials = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); var client = this.BuildVonageClient(credentials); - var response = await client.ApplicationClient.CreateApplicaitonAsync(request); + var response = await client.ApplicationClient.CreateApplicationAsync(request); response.Privacy.Should().Be(new PrivacySettings(true)); response.Capabilities.Should().BeEquivalentTo(new ApplicationCapabilities()); response.Keys.Should().BeEquivalentTo(new Keys @@ -315,14 +219,14 @@ public async Task CreateApplicationAsyncWithVoiceTimeouts() }; var credentials = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); var client = this.BuildVonageClient(credentials); - var response = await client.ApplicationClient.CreateApplicaitonAsync(request); + var response = await client.ApplicationClient.CreateApplicationAsync(request); response.Capabilities.Voice.Webhooks[VoiceWebhookType.AnswerUrl].Should().Be(answerWebhook); response.Capabilities.Voice.Webhooks[VoiceWebhookType.EventUrl].Should().Be(eventWebhook); response.Capabilities.Voice.Webhooks[VoiceWebhookType.FallbackAnswerUrl].Should().Be(fallbackWebhook); } [Fact] - public async Task CreateApplicationWithMeetingsCapabilities() + public async Task CreateApplicationAsyncWithMeetingsCapabilities() { var expectedResponseContent = this.GetResponseJson(); var expectedRequestContent = this.GetRequestJson(); @@ -344,27 +248,10 @@ public async Task CreateApplicationWithMeetingsCapabilities() }; var credentials = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); var client = this.BuildVonageClient(credentials); - var response = await client.ApplicationClient.CreateApplicaitonAsync(request); + var response = await client.ApplicationClient.CreateApplicationAsync(request); response.Capabilities.Meetings.Webhooks.Should().BeEquivalentTo(response.Capabilities.Meetings.Webhooks); } - [Theory] - [InlineData(false)] - [InlineData(true)] - public void DeleteApplication(bool passCreds) - { - var id = "78d335fa323d01149c3dd6f0d48968cf"; - var uri = $"{this.ApiUrl}/v2/applications/{id}"; - var expectedResponse = ""; - this.Setup(uri, expectedResponse); - var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); - var client = this.BuildVonageClient(creds); - var result = passCreds - ? client.ApplicationClient.DeleteApplication(id, creds) - : client.ApplicationClient.DeleteApplication(id); - Assert.True(result); - } - [Theory] [InlineData(false)] [InlineData(true)] @@ -389,52 +276,6 @@ public async Task DeleteApplicationAsync(bool passCreds) Assert.True(result); } - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GetApplication(bool passCreds) - { - var id = "78d335fa323d01149c3dd6f0d48968cf"; - var expectedResponse = this.GetResponseJson(); - var expectedUri = $"{this.ApiUrl}/v2/applications/{id}"; - this.Setup(expectedUri, expectedResponse); - var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); - var client = this.BuildVonageClient(creds); - var application = passCreds - ? client.ApplicationClient.GetApplication(id, creds) - : client.ApplicationClient.GetApplication(id); - Assert.Equal("78d335fa323d01149c3dd6f0d48968cf", application.Id); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get), application.Capabilities.Voice.Webhooks[VoiceWebhookType.AnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get), - application.Capabilities.Voice.Webhooks[VoiceWebhookType.FallbackAnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/event"), - HttpMethod.Post), application.Capabilities.Voice.Webhooks[VoiceWebhookType.EventUrl]); - Assert.Equal("https://example.com/webhooks/inbound", - application.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Address); - Assert.Equal("POST", application.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Method); - Assert.Equal("https://example.com/webhooks/status", - application.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Address); - Assert.Equal("POST", application.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Method); - Assert.Equal("https://example.com/webhooks/event", - application.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Address); - Assert.Equal("POST", application.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Method); - Assert.Equal("My Application", application.Name); - Assert.Equal("http://example.com", - application.Capabilities.Meetings.Webhooks[Webhook.Type.RoomChanged].Address); - Assert.Equal("POST", application.Capabilities.Meetings.Webhooks[Webhook.Type.RoomChanged].Method); - Assert.Equal("http://example.com", - application.Capabilities.Meetings.Webhooks[Webhook.Type.SessionChanged].Address); - Assert.Equal("POST", application.Capabilities.Meetings.Webhooks[Webhook.Type.SessionChanged].Method); - Assert.Equal("https://54eba990d025.ngrok.app/recordings", - application.Capabilities.Meetings.Webhooks[Webhook.Type.RecordingChanged].Address); - Assert.Equal("POST", application.Capabilities.Meetings.Webhooks[Webhook.Type.RecordingChanged].Method); - } - [Theory] [InlineData(false)] [InlineData(true)] @@ -525,113 +366,6 @@ public async Task GetApplicationAsync(bool passCreds) Assert.Equal("My Application", application.Name); } - [Theory] - [InlineData(false, false)] - [InlineData(true, true)] - public void ListApplications(bool passCreds, bool passParameters) - { - var expectedResult = @"{ - ""page_size"": 10, - ""page"": 1, - ""total_items"": 6, - ""total_pages"": 1, - ""_embedded"": { - ""applications"": [ - { - ""id"": ""78d335fa323d01149c3dd6f0d48968cf"", - ""name"": ""My Application"", - ""capabilities"": { - ""voice"": { - ""webhooks"": { - ""answer_url"": { - ""address"": ""https://example.com/webhooks/answer"", - ""http_method"": ""GET"" - }, - ""fallback_answer_url"": { - ""address"": ""https://fallback.example.com/webhooks/answer"", - ""http_method"": ""GET"" - }, - ""event_url"": { - ""address"": ""https://example.com/webhooks/event"", - ""http_method"": ""POST"" - } - } - }, - ""messages"": { - ""webhooks"": { - ""inbound_url"": { - ""address"": ""https://example.com/webhooks/inbound"", - ""http_method"": ""POST"" - }, - ""status_url"": { - ""address"": ""https://example.com/webhooks/status"", - ""http_method"": ""POST"" - } - } - }, - ""rtc"": { - ""webhooks"": { - ""event_url"": { - ""address"": ""https://example.com/webhooks/event"", - ""http_method"": ""POST"" - } - } - }, - ""vbc"": {} - } - } - ] - } - }"; - string expectedUri; - ListApplicationsRequest request; - if (passParameters) - { - expectedUri = $"{this.ApiUrl}/v2/applications?page_size=10&page=1&"; - request = new ListApplicationsRequest {Page = 1, PageSize = 10}; - } - else - { - expectedUri = $"{this.ApiUrl}/v2/applications"; - request = new ListApplicationsRequest(); - } - - this.Setup(expectedUri, expectedResult); - - //Act - var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); - var client = this.BuildVonageClient(creds); - var applications = passCreds - ? client.ApplicationClient.ListApplications(request, creds) - : client.ApplicationClient.ListApplications(request); - var application = applications.Embedded.Applications[0]; - Assert.Equal("78d335fa323d01149c3dd6f0d48968cf", application.Id); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get), application.Capabilities.Voice.Webhooks[VoiceWebhookType.AnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get), - application.Capabilities.Voice.Webhooks[VoiceWebhookType.FallbackAnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/event"), - HttpMethod.Post), application.Capabilities.Voice.Webhooks[VoiceWebhookType.EventUrl]); - Assert.Equal("https://example.com/webhooks/inbound", - application.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Address); - Assert.Equal("POST", application.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Method); - Assert.Equal("https://example.com/webhooks/status", - application.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Address); - Assert.Equal("POST", application.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Method); - Assert.Equal("https://example.com/webhooks/event", - application.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Address); - Assert.Equal("POST", application.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Method); - Assert.Equal("My Application", application.Name); - Assert.Equal(6, applications.TotalItems); - Assert.Equal(1, applications.TotalPages); - Assert.Equal(10, applications.PageSize); - Assert.Equal(1, applications.Page); - } - [Theory] [InlineData(false, false)] [InlineData(true, true)] @@ -746,142 +480,6 @@ public async Task ListApplicationsAsync(bool passCreds, bool passParameters) Assert.Equal(1, applications.Page); } - [Theory] - [InlineData(false)] - [InlineData(true)] - public void UpdateApplication(bool passCredentials) - { - var id = "78d335fa323d01149c3dd6f0d48968cf"; - var uri = $"{this.ApiUrl}/v2/applications/{id}"; - var expectedResponse = @"{ - ""id"": ""78d335fa323d01149c3dd6f0d48968cf"", - ""name"": ""My Application"", - ""capabilities"": { - ""voice"": { - ""webhooks"": { - ""answer_url"": { - ""address"": ""https://example.com/webhooks/answer"", - ""http_method"": ""GET"" - }, - ""fallback_answer_url"": { - ""address"": ""https://fallback.example.com/webhooks/answer"", - ""http_method"": ""GET"" - }, - ""event_url"": { - ""address"": ""https://example.com/webhooks/event"", - ""http_method"": ""POST"" - } - } - }, - ""messages"": { - ""webhooks"": { - ""inbound_url"": { - ""address"": ""https://example.com/webhooks/inbound"", - ""http_method"": ""POST"" - }, - ""status_url"": { - ""address"": ""https://example.com/webhooks/status"", - ""http_method"": ""POST"" - } - } - }, - ""rtc"": { - ""webhooks"": { - ""event_url"": { - ""address"": ""https://example.com/webhooks/event"", - ""http_method"": ""POST"" - } - } - }, - ""vbc"": { } - }, - ""keys"": { - ""public_key"": ""some public key"", - ""private_key"": ""some private key"" - } - }"; - var expectedRequestContent = - @"{""name"":""My Application"",""capabilities"":{""voice"":{""webhooks"":{""answer_url"":{""http_method"":""GET"",""address"":""https://example.com/webhooks/answer""},""event_url"":{""http_method"":""POST"",""address"":""https://example.com/webhooks/events""},""fallback_answer_url"":{""http_method"":""GET"",""address"":""https://fallback.example.com/webhooks/answer""}}},""rtc"":{""webhooks"":{""event_url"":{""http_method"":""POST"",""address"":""https://example.com/webhooks/events""}}},""vbc"":{},""messages"":{""webhooks"":{""inbound_url"":{""http_method"":""POST"",""address"":""https://example.com/webhooks/inbound""},""status_url"":{""http_method"":""POST"",""address"":""https://example.com/webhooks/status""}}}},""keys"":{""public_key"":""some public key""}}"; - this.Setup(uri, expectedResponse, expectedRequestContent); - - //ACT - var messagesWebhooks = new Dictionary - { - { - Webhook.Type.InboundUrl, - new Webhook {Address = "https://example.com/webhooks/inbound", Method = "POST"} - }, - { - Webhook.Type.StatusUrl, - new Webhook {Address = "https://example.com/webhooks/status", Method = "POST"} - }, - }; - var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks); - var rtcWebhooks = new Dictionary - { - {Webhook.Type.EventUrl, new Webhook {Address = "https://example.com/webhooks/events", Method = "POST"}}, - }; - var rtcCapability = new Rtc(rtcWebhooks); - var voiceWebhooks = new Dictionary - { - { - VoiceWebhookType.AnswerUrl, - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get) - }, - { - VoiceWebhookType.EventUrl, - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/events"), - HttpMethod.Post) - }, - { - VoiceWebhookType.FallbackAnswerUrl, - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get) - }, - }; - var voiceCapability = new Applications.Capabilities.Voice - { - Webhooks = voiceWebhooks, - }; - JsonConvert.SerializeObject(voiceCapability); - var vbcCapability = new Vbc(); - var capabilities = new ApplicationCapabilities - {Messages = messagesCapability, Rtc = rtcCapability, Voice = voiceCapability, Vbc = vbcCapability}; - var keys = new Keys - { - PublicKey = PublicKey, - }; - var application = new CreateApplicationRequest - {Capabilities = capabilities, Keys = keys, Name = "My Application"}; - var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret); - var client = this.BuildVonageClient(creds); - var response = passCredentials - ? client.ApplicationClient.UpdateApplication(id, application) - : client.ApplicationClient.UpdateApplication(id, application, creds); - Assert.Equal("78d335fa323d01149c3dd6f0d48968cf", response.Id); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/answer"), - HttpMethod.Get), response.Capabilities.Voice.Webhooks[VoiceWebhookType.AnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook( - new Uri("https://fallback.example.com/webhooks/answer"), HttpMethod.Get), - response.Capabilities.Voice.Webhooks[VoiceWebhookType.FallbackAnswerUrl]); - Assert.Equal( - new Applications.Capabilities.Voice.VoiceWebhook(new Uri("https://example.com/webhooks/event"), - HttpMethod.Post), response.Capabilities.Voice.Webhooks[VoiceWebhookType.EventUrl]); - Assert.Equal("https://example.com/webhooks/inbound", - response.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Address); - Assert.Equal("POST", response.Capabilities.Messages.Webhooks[Webhook.Type.InboundUrl].Method); - Assert.Equal("https://example.com/webhooks/status", - response.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Address); - Assert.Equal("POST", response.Capabilities.Messages.Webhooks[Webhook.Type.StatusUrl].Method); - Assert.Equal("https://example.com/webhooks/event", - response.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Address); - Assert.Equal("POST", response.Capabilities.Rtc.Webhooks[Webhook.Type.EventUrl].Method); - Assert.Equal("My Application", response.Name); - } - [Theory] [InlineData(false)] [InlineData(true)] diff --git a/Vonage.Test/Data/ApplicationTests/CreateApplication-request.json b/Vonage.Test/Data/ApplicationTests/CreateApplicationAsync-request.json similarity index 100% rename from Vonage.Test/Data/ApplicationTests/CreateApplication-request.json rename to Vonage.Test/Data/ApplicationTests/CreateApplicationAsync-request.json diff --git a/Vonage.Test/Data/ApplicationTests/CreateApplication-response.json b/Vonage.Test/Data/ApplicationTests/CreateApplicationAsync-response.json similarity index 100% rename from Vonage.Test/Data/ApplicationTests/CreateApplication-response.json rename to Vonage.Test/Data/ApplicationTests/CreateApplicationAsync-response.json diff --git a/Vonage.Test/Data/ApplicationTests/CreateApplicationWithMeetingsCapabilities-request.json b/Vonage.Test/Data/ApplicationTests/CreateApplicationAsyncWithMeetingsCapabilities-request.json similarity index 100% rename from Vonage.Test/Data/ApplicationTests/CreateApplicationWithMeetingsCapabilities-request.json rename to Vonage.Test/Data/ApplicationTests/CreateApplicationAsyncWithMeetingsCapabilities-request.json diff --git a/Vonage.Test/Data/ApplicationTests/CreateApplicationWithMeetingsCapabilities-response.json b/Vonage.Test/Data/ApplicationTests/CreateApplicationAsyncWithMeetingsCapabilities-response.json similarity index 100% rename from Vonage.Test/Data/ApplicationTests/CreateApplicationWithMeetingsCapabilities-response.json rename to Vonage.Test/Data/ApplicationTests/CreateApplicationAsyncWithMeetingsCapabilities-response.json diff --git a/Vonage.Test/Vonage.Test.csproj b/Vonage.Test/Vonage.Test.csproj index 1fceb3394..ad73d4a78 100644 --- a/Vonage.Test/Vonage.Test.csproj +++ b/Vonage.Test/Vonage.Test.csproj @@ -86,10 +86,10 @@ PreserveNewest - + PreserveNewest - + PreserveNewest @@ -873,10 +873,10 @@ PreserveNewest - + PreserveNewest - + PreserveNewest diff --git a/Vonage/Applications/ApplicationClient.cs b/Vonage/Applications/ApplicationClient.cs index 6a6e21f0a..92f84778e 100644 --- a/Vonage/Applications/ApplicationClient.cs +++ b/Vonage/Applications/ApplicationClient.cs @@ -1,4 +1,3 @@ -using System; using System.Net.Http; using System.Threading.Tasks; using Vonage.Common; @@ -26,28 +25,6 @@ internal ApplicationClient(Credentials credentials, Configuration configuration, public Credentials Credentials { get; set; } - /// - [Obsolete("Favor asynchronous version instead.")] - public Application CreateApplicaiton(CreateApplicationRequest request, Credentials creds = null) => - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoRequestWithJsonContent( - HttpMethod.Post, - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/v2/applications"), - request, - AuthType.Basic - ); - - /// - [Obsolete("Favor typo-free method instead.")] - public Task CreateApplicaitonAsync(CreateApplicationRequest request, Credentials creds = null) => - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoRequestWithJsonContentAsync( - HttpMethod.Post, - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/v2/applications"), - request, - AuthType.Basic - ); - /// public Task CreateApplicationAsync(CreateApplicationRequest request, Credentials creds = null) => ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) @@ -58,19 +35,6 @@ public Task CreateApplicationAsync(CreateApplicationRequest request AuthType.Basic ); - /// - [Obsolete("Favor asynchronous version instead.")] - public bool DeleteApplication(string id, Credentials creds = null) - { - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoDeleteRequestWithUrlContent( - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, $"/v2/applications/{id}"), - null, - AuthType.Basic - ); - return true; - } - /// public async Task DeleteApplicationAsync(string id, Credentials creds = null) { @@ -83,15 +47,6 @@ await ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.time return true; } - /// - [Obsolete("Favor asynchronous version instead.")] - public Application GetApplication(string id, Credentials creds = null) => - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoGetRequestWithQueryParameters( - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, $"/v2/applications/{id}"), - AuthType.Basic - ); - /// public Task GetApplicationAsync(string id, Credentials creds = null) => ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) @@ -100,16 +55,6 @@ public Task GetApplicationAsync(string id, Credentials creds = null AuthType.Basic ); - /// - [Obsolete("Favor asynchronous version instead.")] - public ApplicationPage ListApplications(ListApplicationsRequest request, Credentials creds = null) => - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoGetRequestWithQueryParameters( - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/v2/applications"), - AuthType.Basic, - request - ); - /// public Task ListApplicationsAsync(ListApplicationsRequest request, Credentials creds = null) => ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) @@ -119,17 +64,6 @@ public Task ListApplicationsAsync(ListApplicationsRequest reque request ); - /// - [Obsolete("Favor asynchronous version instead.")] - public Application UpdateApplication(string id, CreateApplicationRequest request, Credentials creds = null) => - ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider) - .DoRequestWithJsonContent( - HttpMethod.Put, - ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, $"/v2/applications/{id}"), - request, - AuthType.Basic - ); - /// public Task UpdateApplicationAsync(string id, CreateApplicationRequest request, Credentials creds = null) => diff --git a/Vonage/Applications/IApplicationClient.cs b/Vonage/Applications/IApplicationClient.cs index 93cfaf463..675b69c73 100644 --- a/Vonage/Applications/IApplicationClient.cs +++ b/Vonage/Applications/IApplicationClient.cs @@ -5,22 +5,6 @@ namespace Vonage.Applications; public interface IApplicationClient { - /// - /// Application Name - /// - /// - /// - /// - Application CreateApplicaiton(CreateApplicationRequest request, Credentials creds = null); - - /// - /// Application Name - /// - /// - /// - /// - Task CreateApplicaitonAsync(CreateApplicationRequest request, Credentials creds = null); - /// /// Creates a new application. /// @@ -29,14 +13,6 @@ public interface IApplicationClient /// The application. Task CreateApplicationAsync(CreateApplicationRequest request, Credentials creds = null); - /// - /// Deletes an application: Cannot be undone - /// - /// Id of the application to be deleted - /// - /// - bool DeleteApplication(string id, Credentials creds = null); - /// /// Deletes an application: Cannot be undone /// @@ -45,14 +21,6 @@ public interface IApplicationClient /// Task DeleteApplicationAsync(string id, Credentials creds = null); - /// - /// Retrieves information about an application - /// - /// Id of the application to be retrieved - /// - /// - Application GetApplication(string id, Credentials creds = null); - /// /// Retrieves information about an application /// @@ -61,14 +29,6 @@ public interface IApplicationClient /// Task GetApplicationAsync(string id, Credentials creds = null); - /// - /// List applications - /// - /// - /// - /// - ApplicationPage ListApplications(ListApplicationsRequest request, Credentials creds = null); - /// /// List applications /// @@ -77,15 +37,6 @@ public interface IApplicationClient /// Task ListApplicationsAsync(ListApplicationsRequest request, Credentials creds = null); - /// - /// Updates an Application - /// - /// Id of the application to be updated - /// - /// - /// - Application UpdateApplication(string id, CreateApplicationRequest request, Credentials creds = null); - /// /// Updates an Application ///