diff --git a/Vonage.Test/VerifyV2/GetTemplateFragments/Data/ShouldDeserialize200-response.json b/Vonage.Test/VerifyV2/GetTemplateFragments/Data/ShouldDeserialize200-response.json new file mode 100644 index 00000000..bfd728cf --- /dev/null +++ b/Vonage.Test/VerifyV2/GetTemplateFragments/Data/ShouldDeserialize200-response.json @@ -0,0 +1,40 @@ +{ + "page_size": 1, + "page": 2, + "total_pages": 10, + "total_items": 25, + "_embedded": { + "template_fragments": [ + { + "template_fragment_id": "c70f446e-997a-4313-a081-60a02a31dc19", + "channel": "sms", + "locale": "en-us", + "text": "Text content of the template. May contain 4 reserved variables: `${code}`, `${brand}`, `${time-limit}` and `${time-limit-unit}`", + "date_updated": "2023-08-30T15:20:15.178Z", + "date_created": "2021-08-30T20:12:15.178Z", + "_links": { + "self": { + "href": "https://api.nexmo.com/v2/verify/templates/8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9/template_fragments/c70f446e-997a-4313-a081-60a02a31dc19" + }, + "template": { + "href": "https://api.nexmo.com/v2/verify/templates/8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9" + } + } + } + ] + }, + "_links": { + "self": { + "href": "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=2" + }, + "next": { + "href": "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=3" + }, + "prev": { + "href": "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=1" + }, + "last": { + "href": "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=5" + } + } +} \ No newline at end of file diff --git a/Vonage.Test/VerifyV2/GetTemplateFragments/E2ETest.cs b/Vonage.Test/VerifyV2/GetTemplateFragments/E2ETest.cs new file mode 100644 index 00000000..280c8c9c --- /dev/null +++ b/Vonage.Test/VerifyV2/GetTemplateFragments/E2ETest.cs @@ -0,0 +1,99 @@ +#region +using System; +using System.Net; +using System.Threading.Tasks; +using Vonage.Test.Common.Extensions; +using Vonage.VerifyV2.GetTemplateFragments; +using WireMock.ResponseBuilders; +using Xunit; +#endregion + +namespace Vonage.Test.VerifyV2.GetTemplateFragments; + +[Trait("Category", "E2E")] +public class E2ETest : E2EBase +{ + public E2ETest() : base(typeof(E2ETest).Namespace) + { + } + + [Fact] + public async Task GetTemplateFragmentsEmpty() + { + this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create() + .WithPath("/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments") + .WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue) + .UsingGet()) + .RespondWith(Response.Create() + .WithStatusCode(HttpStatusCode.OK) + .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); + await this.Helper.VonageClient.VerifyV2Client + .GetTemplateFragmentsAsync(GetTemplateFragmentsRequest + .Build() + .WithTemplateId(RequestBuilderTest.ValidTemplateId) + .Create()) + .Should() + .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); + } + + [Fact] + public async Task GetTemplatesEmptyFromResponse() + { + this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create() + .WithPath("/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments") + .WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue) + .UsingGet()) + .RespondWith(Response.Create() + .WithStatusCode(HttpStatusCode.OK) + .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); + await this.Helper.VonageClient.VerifyV2Client + .GetTemplateFragmentsAsync( + new GetTemplateFragmentsHalLink(new Uri( + "https://api.nexmo.com/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments")) + .BuildRequest()) + .Should() + .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); + } + + [Fact] + public async Task GetTemplatesFromResponse() + { + this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create() + .WithPath("/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments") + .WithParam("page_size", "15") + .WithParam("page", "50") + .WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue) + .UsingGet()) + .RespondWith(Response.Create() + .WithStatusCode(HttpStatusCode.OK) + .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); + await this.Helper.VonageClient.VerifyV2Client + .GetTemplateFragmentsAsync( + new GetTemplateFragmentsHalLink(new Uri( + "https://api.nexmo.com/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments?page_size=15&page=50")) + .BuildRequest()) + .Should() + .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); + } + + [Fact] + public async Task GetTemplates() + { + this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create() + .WithPath("/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments") + .WithParam("page_size", "15") + .WithParam("page", "50") + .WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue) + .UsingGet()) + .RespondWith(Response.Create() + .WithStatusCode(HttpStatusCode.OK) + .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); + await this.Helper.VonageClient.VerifyV2Client + .GetTemplateFragmentsAsync(GetTemplateFragmentsRequest + .Build() + .WithTemplateId(RequestBuilderTest.ValidTemplateId) + .WithPageSize(15).WithPage(50).Create()) + .Should() + .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); + } +} \ No newline at end of file diff --git a/Vonage.Test/VerifyV2/GetTemplateFragments/RequestBuilderTest.cs b/Vonage.Test/VerifyV2/GetTemplateFragments/RequestBuilderTest.cs new file mode 100644 index 00000000..35831b02 --- /dev/null +++ b/Vonage.Test/VerifyV2/GetTemplateFragments/RequestBuilderTest.cs @@ -0,0 +1,76 @@ +#region +using System; +using Vonage.Common.Monads; +using Vonage.Test.Common.Extensions; +using Vonage.VerifyV2.GetTemplateFragments; +using Xunit; +#endregion + +namespace Vonage.Test.VerifyV2.GetTemplateFragments; + +[Trait("Category", "Request")] +public class RequestBuilderTest +{ + internal static readonly Guid ValidTemplateId = new Guid("68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb"); + + [Fact] + public void Parse_ShouldReturnFailure_GivenRequestIsEmpty() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(Guid.Empty) + .Create() + .Should() + .BeParsingFailure("TemplateId cannot be empty."); + + [Fact] + public void Build_ShouldHaveNoDefaultPageSize() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(ValidTemplateId) + .Create() + .Map(request => request.PageSize) + .Should() + .BeSuccess(Maybe.None); + + [Fact] + public void Build_ShouldHaveNoDefaultPage() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(ValidTemplateId) + .Create() + .Map(request => request.Page) + .Should() + .BeSuccess(Maybe.None); + + [Fact] + public void Build_ShouldSetTemplateId() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(ValidTemplateId) + .Create() + .Map(request => request.TemplateId) + .Should() + .BeSuccess(ValidTemplateId); + + [Fact] + public void Build_ShouldSetPageSize() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(ValidTemplateId) + .WithPageSize(50) + .Create() + .Map(request => request.PageSize) + .Should() + .BeSuccess(50); + + [Fact] + public void Build_ShouldSetPage() => + GetTemplateFragmentsRequest + .Build() + .WithTemplateId(ValidTemplateId) + .WithPage(50) + .Create() + .Map(request => request.Page) + .Should() + .BeSuccess(50); +} \ No newline at end of file diff --git a/Vonage.Test/VerifyV2/GetTemplateFragments/RequestTest.cs b/Vonage.Test/VerifyV2/GetTemplateFragments/RequestTest.cs new file mode 100644 index 00000000..4bd9e7d0 --- /dev/null +++ b/Vonage.Test/VerifyV2/GetTemplateFragments/RequestTest.cs @@ -0,0 +1,33 @@ +#region +using Vonage.Test.Common.Extensions; +using Vonage.VerifyV2.GetTemplateFragments; +using Xunit; +#endregion + +namespace Vonage.Test.VerifyV2.GetTemplateFragments; + +[Trait("Category", "Request")] +public class RequestTest +{ + [Theory] + [InlineData(null, null, "/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments")] + [InlineData(30, null, "/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments?page_size=30")] + [InlineData(null, 50, "/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments?page=50")] + [InlineData(30, 50, + "/v2/verify/templates/68c2b32e-55ba-4a8e-b3fa-43b3ae6cd1fb/template_fragments?page_size=30&page=50")] + public void GetEndpointPath_ShouldReturnApiEndpoint(int? pageSize, int? page, string expectedEndpoint) + { + var builder = GetTemplateFragmentsRequest.Build().WithTemplateId(RequestBuilderTest.ValidTemplateId); + if (pageSize.HasValue) + { + builder = builder.WithPageSize(pageSize.Value); + } + + if (page.HasValue) + { + builder = builder.WithPage(page.Value); + } + + builder.Create().Map(request => request.GetEndpointPath()).Should().BeSuccess(expectedEndpoint); + } +} \ No newline at end of file diff --git a/Vonage.Test/VerifyV2/GetTemplateFragments/SerializationTest.cs b/Vonage.Test/VerifyV2/GetTemplateFragments/SerializationTest.cs new file mode 100644 index 00000000..23ae293b --- /dev/null +++ b/Vonage.Test/VerifyV2/GetTemplateFragments/SerializationTest.cs @@ -0,0 +1,59 @@ +#region +using System; +using FluentAssertions; +using Vonage.Serialization; +using Vonage.Test.Common; +using Vonage.Test.Common.Extensions; +using Vonage.VerifyV2; +using Vonage.VerifyV2.GetTemplateFragments; +using Vonage.VerifyV2.StartVerification; +using Xunit; +#endregion + +namespace Vonage.Test.VerifyV2.GetTemplateFragments; + +[Trait("Category", "Serialization")] +public class SerializationTest +{ + private readonly SerializationTestHelper helper = new SerializationTestHelper( + typeof(SerializationTest).Namespace, + JsonSerializerBuilder.BuildWithSnakeCase()); + + [Fact] + public void ShouldDeserialize200() => + this.helper.Serializer + .DeserializeObject(this.helper.GetResponseJson()) + .Should() + .BeSuccess(VerifyExpectedResponse); + + internal static void VerifyExpectedResponse(GetTemplateFragmentsResponse response) + { + response.PageSize.Should().Be(1); + response.Page.Should().Be(2); + response.TotalPages.Should().Be(10); + response.TotalItems.Should().Be(25); + response.Links.Self.Href.Should() + .Be(new Uri( + "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=2")); + response.Links.Next.Href.Should() + .Be(new Uri( + "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=3")); + response.Links.Previous.Href.Should() + .Be(new Uri( + "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=1")); + response.Links.Last.Href.Should() + .Be(new Uri( + "https://api.nexmo.com/v2/verify/templates/c70f446e-997a-4313-a081-60a02a31dc19/template_fragments?page=5")); + response.Embedded.Fragments.Should().HaveCount(1); + response.Embedded.Fragments.Should().BeEquivalentTo(new[] + { + new TemplateFragment( + new Guid("c70f446e-997a-4313-a081-60a02a31dc19"), + VerificationChannel.Sms, + Locale.EnUs, + "Text content of the template. May contain 4 reserved variables: `${code}`, `${brand}`, `${time-limit}` and `${time-limit-unit}`", + DateTimeOffset.Parse("2021-08-30T20:12:15.178Z"), + DateTimeOffset.Parse("2023-08-30T15:20:15.178Z")), + }); + } +} \ No newline at end of file diff --git a/Vonage.Test/VerifyV2/GetTemplates/E2ETest.cs b/Vonage.Test/VerifyV2/GetTemplates/E2ETest.cs index 79472cf9..2f172724 100644 --- a/Vonage.Test/VerifyV2/GetTemplates/E2ETest.cs +++ b/Vonage.Test/VerifyV2/GetTemplates/E2ETest.cs @@ -28,7 +28,7 @@ public async Task GetTemplatesEmpty() .WithStatusCode(HttpStatusCode.OK) .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); await this.Helper.VonageClient.VerifyV2Client - .GetTemplateAsync(GetTemplatesRequest.Build().Create()) + .GetTemplatesAsync(GetTemplatesRequest.Build().Create()) .Should() .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); } @@ -44,7 +44,7 @@ public async Task GetTemplatesEmptyFromResponse() .WithStatusCode(HttpStatusCode.OK) .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); await this.Helper.VonageClient.VerifyV2Client - .GetTemplateAsync( + .GetTemplatesAsync( new GetTemplatesHalLink(new Uri("https://api.nexmo.com/v2/verify/templates")).BuildRequest()) .Should() .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); @@ -63,7 +63,7 @@ public async Task GetTemplatesFromResponse() .WithStatusCode(HttpStatusCode.OK) .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); await this.Helper.VonageClient.VerifyV2Client - .GetTemplateAsync( + .GetTemplatesAsync( new GetTemplatesHalLink(new Uri("https://api.nexmo.com/v2/verify/templates?page_size=15&page=50")) .BuildRequest()) .Should() @@ -83,7 +83,7 @@ public async Task GetTemplates() .WithStatusCode(HttpStatusCode.OK) .WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); await this.Helper.VonageClient.VerifyV2Client - .GetTemplateAsync(GetTemplatesRequest.Build().WithPageSize(15).WithPage(50).Create()) + .GetTemplatesAsync(GetTemplatesRequest.Build().WithPageSize(15).WithPage(50).Create()) .Should() .BeSuccessAsync(SerializationTest.VerifyExpectedResponse); } diff --git a/Vonage.Test/Vonage.Test.csproj b/Vonage.Test/Vonage.Test.csproj index 6d55b236..a1f598ca 100644 --- a/Vonage.Test/Vonage.Test.csproj +++ b/Vonage.Test/Vonage.Test.csproj @@ -1340,6 +1340,9 @@ PreserveNewest + + PreserveNewest + diff --git a/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequest.cs b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequest.cs new file mode 100644 index 00000000..0d1d8834 --- /dev/null +++ b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequest.cs @@ -0,0 +1,52 @@ +#region +using System; +using System.Collections.Generic; +using System.Net.Http; +using Vonage.Common; +using Vonage.Common.Client; +using Vonage.Common.Monads; +#endregion + +namespace Vonage.VerifyV2.GetTemplateFragments; + +/// +public readonly struct GetTemplateFragmentsRequest : IVonageRequest +{ + /// + /// ID of the template. + /// + public Guid TemplateId { get; internal init; } + + /// + /// Number of results per page. + /// + public Maybe PageSize { get; internal init; } + + /// + /// The page. + /// + public Maybe Page { get; internal init; } + + /// + public HttpRequestMessage BuildRequestMessage() => VonageRequestBuilder + .Initialize(HttpMethod.Get, this.GetEndpointPath()) + .Build(); + + /// + public string GetEndpointPath() => UriHelpers.BuildUri($"/v2/verify/templates/{this.TemplateId}/template_fragments", + this.GetQueryStringParameters()); + + private Dictionary GetQueryStringParameters() + { + var parameters = new Dictionary(); + this.PageSize.IfSome(some => parameters.Add("page_size", some.ToString())); + this.Page.IfSome(some => parameters.Add("page", some.ToString())); + return parameters; + } + + /// + /// Initializes a builder for GetTemplateFragments. + /// + /// The builder. + public static IBuilderForTemplateId Build() => new GetTemplateFragmentsRequestBuilder(); +} \ No newline at end of file diff --git a/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequestBuilder.cs b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequestBuilder.cs new file mode 100644 index 00000000..5fd2d9ab --- /dev/null +++ b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesRequestBuilder.cs @@ -0,0 +1,67 @@ +#region +using System; +using Vonage.Common.Client; +using Vonage.Common.Monads; +using Vonage.Common.Validation; +#endregion + +namespace Vonage.VerifyV2.GetTemplateFragments; + +internal struct GetTemplateFragmentsRequestBuilder : IBuilderForOptional, IBuilderForTemplateId +{ + private Maybe page; + private Maybe pageSize; + private Guid templateId; + + /// + public Result Create() => Result.FromSuccess( + new GetTemplateFragmentsRequest + { + TemplateId = this.templateId, + PageSize = this.pageSize, + Page = this.page, + }) + .Map(InputEvaluation.Evaluate) + .Bind(evaluation => evaluation.WithRules(VerifyTemplateId)); + + public IBuilderForOptional WithPageSize(int value) => this with {pageSize = value}; + public IBuilderForOptional WithPage(int value) => this with {page = value}; + public IBuilderForOptional WithTemplateId(Guid value) => this with {templateId = value}; + + private static Result VerifyTemplateId( + GetTemplateFragmentsRequest request) => + InputValidation.VerifyNotEmpty(request, request.TemplateId, nameof(request.TemplateId)); +} + +/// +/// Represents a builder to set the TemplateId. +/// +public interface IBuilderForTemplateId +{ + /// + /// Sets the TemplateId. + /// + /// The template id. + /// The builder. + IBuilderForOptional WithTemplateId(Guid value); +} + +/// +/// Represents a builder for optional values. +/// +public interface IBuilderForOptional : IVonageRequestBuilder +{ + /// + /// Sets the page size on the builder. + /// + /// The page size. + /// The builder. + IBuilderForOptional WithPageSize(int value); + + /// + /// Sets the page on the builder. + /// + /// The page. + /// The builder. + IBuilderForOptional WithPage(int value); +} \ No newline at end of file diff --git a/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesResponse.cs b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesResponse.cs new file mode 100644 index 00000000..5584aff3 --- /dev/null +++ b/Vonage/VerifyV2/GetTemplateFragments/GetTemplatesResponse.cs @@ -0,0 +1,75 @@ +#region +using System; +using System.Text.Json.Serialization; +using System.Web; +using Vonage.Common; +using Vonage.Common.Monads; +#endregion + +namespace Vonage.VerifyV2.GetTemplateFragments; + +public record GetTemplateFragmentsResponse( + [property: JsonPropertyName("page_size")] + [property: JsonPropertyOrder(0)] + int PageSize, + [property: JsonPropertyName("page")] + [property: JsonPropertyOrder(1)] + int Page, + [property: JsonPropertyName("total_pages")] + [property: JsonPropertyOrder(2)] + int TotalPages, + [property: JsonPropertyName("total_items")] + [property: JsonPropertyOrder(3)] + int TotalItems, + [property: JsonPropertyName("_embedded")] + [property: JsonPropertyOrder(4)] + GetTemplateFragmentsEmbedded Embedded, + [property: JsonPropertyName("_links")] + [property: JsonPropertyOrder(5)] + HalLinks Links); + +public record GetTemplateFragmentsEmbedded( + [property: JsonPropertyName("template_fragments")] + [property: JsonPropertyOrder(0)] + TemplateFragment[] Fragments); + +/// +/// Represents a link to another resource. +/// +/// Hyperlink reference. +public record GetTemplateFragmentsHalLink(Uri Href) +{ + /// + /// Transforms the link into a GetEventsRequest using the cursor pagination. + /// + /// + public Result BuildRequest() + { + var parameters = ExtractQueryParameters(this.Href); + var builder = new GetTemplateFragmentsRequestBuilder().WithTemplateId(parameters.TemplateId); + builder = parameters.ApplyPageSize(builder); + builder = parameters.ApplyPage(builder); + return builder.Create(); + } + + private static QueryParameters ExtractQueryParameters(Uri uri) + { + var queryParameters = HttpUtility.ParseQueryString(uri.Query); + var templateId = Guid.Parse(uri.Segments[^2].Trim('/')); + var pageSize = queryParameters["page_size"] ?? Maybe.None; + var page = queryParameters["page"] ?? Maybe.None; + return new QueryParameters(templateId, pageSize.Map(int.Parse), page.Map(int.Parse)); + } + + private record QueryParameters( + Guid TemplateId, + Maybe PageSize, + Maybe Page) + { + public IBuilderForOptional ApplyPageSize(IBuilderForOptional builder) => + this.PageSize.Match(builder.WithPageSize, () => builder); + + public IBuilderForOptional ApplyPage(IBuilderForOptional builder) => + this.Page.Match(builder.WithPage, () => builder); + } +} \ No newline at end of file diff --git a/Vonage/VerifyV2/IVerifyV2Client.cs b/Vonage/VerifyV2/IVerifyV2Client.cs index 0f5ec0d1..caa13643 100644 --- a/Vonage/VerifyV2/IVerifyV2Client.cs +++ b/Vonage/VerifyV2/IVerifyV2Client.cs @@ -8,6 +8,7 @@ using Vonage.VerifyV2.DeleteTemplateFragment; using Vonage.VerifyV2.GetTemplate; using Vonage.VerifyV2.GetTemplateFragment; +using Vonage.VerifyV2.GetTemplateFragments; using Vonage.VerifyV2.GetTemplates; using Vonage.VerifyV2.NextWorkflow; using Vonage.VerifyV2.StartVerification; @@ -112,5 +113,12 @@ public interface IVerifyV2Client /// /// The request. /// Success or Failure. - Task> GetTemplateAsync(Result request); + Task> GetTemplatesAsync(Result request); + + /// + /// Retrieves template fragments. + /// + /// The request. + /// Success or Failure. + Task> GetTemplateFragmentsAsync(Result request); } \ No newline at end of file diff --git a/Vonage/VerifyV2/VerifyV2Client.cs b/Vonage/VerifyV2/VerifyV2Client.cs index b4f1256e..3926a40a 100644 --- a/Vonage/VerifyV2/VerifyV2Client.cs +++ b/Vonage/VerifyV2/VerifyV2Client.cs @@ -10,6 +10,7 @@ using Vonage.VerifyV2.DeleteTemplateFragment; using Vonage.VerifyV2.GetTemplate; using Vonage.VerifyV2.GetTemplateFragment; +using Vonage.VerifyV2.GetTemplateFragments; using Vonage.VerifyV2.GetTemplates; using Vonage.VerifyV2.NextWorkflow; using Vonage.VerifyV2.StartVerification; @@ -81,6 +82,11 @@ public Task> GetTemplateFragmentAsync(Result(request); /// - public Task> GetTemplateAsync(Result request) => + public Task> GetTemplatesAsync(Result request) => this.vonageClient.SendWithResponseAsync(request); + + /// + public Task> GetTemplateFragmentsAsync( + Result request) => + this.vonageClient.SendWithResponseAsync(request); } \ No newline at end of file