-
Notifications
You must be signed in to change notification settings - Fork 306
/
Copy pathRedirect.cs
82 lines (73 loc) · 2.36 KB
/
Redirect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/// This code was generated by
/// \ / _ _ _| _ _
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
/// / /
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Linq;
using Twilio.Converters;
namespace Twilio.TwiML.Messaging
{
/// <summary>
/// Redirect TwiML Verb
/// </summary>
public class Redirect : TwiML
{
/// <summary>
/// Redirect URL
/// </summary>
public Uri Url { get; set; }
/// <summary>
/// Redirect URL method
/// </summary>
public Twilio.Http.HttpMethod Method { get; set; }
/// <summary>
/// Create a new Redirect
/// </summary>
/// <param name="url"> Redirect URL, the body of the TwiML Element. </param>
/// <param name="method"> Redirect URL method </param>
public Redirect(Uri url = null, Twilio.Http.HttpMethod method = null) : base("Redirect")
{
this.Url = url;
this.Method = method;
}
/// <summary>
/// Return the body of the TwiML tag
/// </summary>
protected override string GetElementBody()
{
return this.Url != null ? Serializers.Url(this.Url) : string.Empty;
}
/// <summary>
/// Return the attributes of the TwiML tag
/// </summary>
protected override IEnumerable<XAttribute> GetElementAttributes()
{
var attributes = new List<XAttribute>();
if (this.Method != null)
{
attributes.Add(new XAttribute("method", this.Method.ToString()));
}
return attributes;
}
/// <summary>
/// Append a child TwiML element to this element returning this element to allow chaining.
/// </summary>
/// <param name="childElem"> Child TwiML element to add </param>
public new Redirect Append(TwiML childElem)
{
return (Redirect) base.Append(childElem);
}
/// <summary>
/// Add freeform key-value attributes to the generated xml
/// </summary>
/// <param name="key"> Option key </param>
/// <param name="value"> Option value </param>
public new Redirect SetOption(string key, object value)
{
return (Redirect) base.SetOption(key, value);
}
}
}