-
Notifications
You must be signed in to change notification settings - Fork 306
/
Copy pathReceive.cs
140 lines (128 loc) · 4.91 KB
/
Receive.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/// 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;
using Twilio.Types;
namespace Twilio.TwiML.Fax
{
/// <summary>
/// Receive TwiML Verb
/// </summary>
public class Receive : TwiML
{
public sealed class MediaTypeEnum : StringEnum
{
private MediaTypeEnum(string value) : base(value) {}
public MediaTypeEnum() {}
public static implicit operator MediaTypeEnum(string value)
{
return new MediaTypeEnum(value);
}
public static readonly MediaTypeEnum ApplicationPdf = new MediaTypeEnum("application/pdf");
public static readonly MediaTypeEnum ImageTiff = new MediaTypeEnum("image/tiff");
}
public sealed class PageSizeEnum : StringEnum
{
private PageSizeEnum(string value) : base(value) {}
public PageSizeEnum() {}
public static implicit operator PageSizeEnum(string value)
{
return new PageSizeEnum(value);
}
public static readonly PageSizeEnum Letter = new PageSizeEnum("letter");
public static readonly PageSizeEnum Legal = new PageSizeEnum("legal");
public static readonly PageSizeEnum A4 = new PageSizeEnum("a4");
}
/// <summary>
/// Receive action URL
/// </summary>
public Uri Action { get; set; }
/// <summary>
/// Receive action URL method
/// </summary>
public Twilio.Http.HttpMethod Method { get; set; }
/// <summary>
/// The media type used to store media in the fax media store
/// </summary>
public Receive.MediaTypeEnum MediaType { get; set; }
/// <summary>
/// What size to interpret received pages as
/// </summary>
public Receive.PageSizeEnum PageSize { get; set; }
/// <summary>
/// Whether or not to store received media in the fax media store
/// </summary>
public bool? StoreMedia { get; set; }
/// <summary>
/// Create a new Receive
/// </summary>
/// <param name="action"> Receive action URL </param>
/// <param name="method"> Receive action URL method </param>
/// <param name="mediaType"> The media type used to store media in the fax media store </param>
/// <param name="pageSize"> What size to interpret received pages as </param>
/// <param name="storeMedia"> Whether or not to store received media in the fax media store </param>
public Receive(Uri action = null,
Twilio.Http.HttpMethod method = null,
Receive.MediaTypeEnum mediaType = null,
Receive.PageSizeEnum pageSize = null,
bool? storeMedia = null) : base("Receive")
{
this.Action = action;
this.Method = method;
this.MediaType = mediaType;
this.PageSize = pageSize;
this.StoreMedia = storeMedia;
}
/// <summary>
/// Return the attributes of the TwiML tag
/// </summary>
protected override IEnumerable<XAttribute> GetElementAttributes()
{
var attributes = new List<XAttribute>();
if (this.Action != null)
{
attributes.Add(new XAttribute("action", Serializers.Url(this.Action)));
}
if (this.Method != null)
{
attributes.Add(new XAttribute("method", this.Method.ToString()));
}
if (this.MediaType != null)
{
attributes.Add(new XAttribute("mediaType", this.MediaType.ToString()));
}
if (this.PageSize != null)
{
attributes.Add(new XAttribute("pageSize", this.PageSize.ToString()));
}
if (this.StoreMedia != null)
{
attributes.Add(new XAttribute("storeMedia", this.StoreMedia.Value.ToString().ToLower()));
}
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 Receive Append(TwiML childElem)
{
return (Receive) 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 Receive SetOption(string key, object value)
{
return (Receive) base.SetOption(key, value);
}
}
}