8000 Add extension methods to `VoiceResponse` and `MessagingResponse` to convert to `TwiMLResult` · Issue #61 · twilio-labs/twilio-aspnet · GitHub
[go: up one dir, main page]

Skip to content
8000
Add extension methods to VoiceResponse and MessagingResponse to convert to TwiMLResult #61
Closed
@Swimburger

Description

@Swimburger

We could add extension methods to make the TwiML generation code more eloquent.
Consider this code:

app.MapPost("/submit", () =>
{
    var voiceResponse = new VoiceResponse()
        .Say($"You pressed 1. Good choice. Goodbye.");
    return Results.Extensions.TwiML(voiceResponse);
});

Which could become:

app.MapPost("/submit",  () => 
    new VoiceResponse()
        .Say($"You pressed 1. Good choice. Goodbye.")
        .ToTwiMLResult()
);

with a convenient extension method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0