-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correcting enum capitalisation for Messaging and Number Insights
- Loading branch information
matt-lethargic
committed
May 23, 2022
1 parent
0a8bd54
commit 7bd3a17
Showing
12 changed files
with
121 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Vonage | ||
{ | ||
internal static class EnumExtensions | ||
{ | ||
internal static T ToEnum<T>(this string str) | ||
where T : Enum | ||
{ | ||
var enumType = typeof(T); | ||
foreach (var name in Enum.GetNames(enumType)) | ||
{ | ||
var enumMemberAttribute = ((EnumMemberAttribute[]) enumType.GetField(name) | ||
.GetCustomAttributes(typeof(EnumMemberAttribute), true)).Single(); | ||
if (enumMemberAttribute.Value == str) | ||
return (T) Enum.Parse(enumType, name); | ||
} | ||
|
||
return default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Vonage.Messaging | ||
{ | ||
public enum SmsType | ||
{ | ||
text = 1, | ||
binary = 2, | ||
wappush = 3, | ||
unicode = 4, | ||
vcal = 5, | ||
vcar = 6 | ||
[EnumMember(Value = "text")] | ||
Text = 1, | ||
|
||
[EnumMember(Value = "binary")] | ||
Binary = 2, | ||
|
||
[EnumMember(Value = "wappush")] | ||
Wappush = 3, | ||
|
||
[EnumMember(Value = "unicode")] | ||
Unicode = 4, | ||
|
||
[EnumMember(Value = "vcal")] | ||
VCal = 5, | ||
|
||
[EnumMember(Value = "vcar")] | ||
VCar = 6 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Vonage.NumberInsights | ||
{ | ||
public enum PortedStatus | ||
{ | ||
unknown, | ||
ported, | ||
not_ported, | ||
assumed_not_ported, | ||
assumed_ported | ||
[EnumMember(Value = "unknown")] | ||
Unknown, | ||
|
||
[EnumMember(Value = "ported")] | ||
Ported, | ||
|
||
[EnumMember(Value = "not_ported")] | ||
NotPorted, | ||
|
||
[EnumMember(Value = "assumed_not_ported")] | ||
AssumedNotPorted, | ||
|
||
[EnumMember(Value = "assumed_ported")] | ||
AssumedPorted | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Vonage.NumberInsights | ||
{ | ||
public enum NumberReachability | ||
{ | ||
unknown, | ||
reachable, | ||
undeliverable, | ||
absent, | ||
bad_number, | ||
blacklisted | ||
[EnumMember(Value = "unknown")] | ||
Unknown, | ||
|
||
[EnumMember(Value = "reachable")] | ||
Reachable, | ||
|
||
[EnumMember(Value = "undeliverable")] | ||
Undeliverable, | ||
|
||
[EnumMember(Value = "absent")] | ||
Absent, | ||
|
||
[EnumMember(Value = "bad_number")] | ||
BadNumber, | ||
|
||
[EnumMember(Value = "blacklisted")] | ||
Blacklisted | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Vonage.NumberInsights | ||
{ | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum RoamingStatus | ||
{ | ||
unknown, | ||
roaming, | ||
not_roaming | ||
[EnumMember(Value = "unknown")] | ||
Unknown, | ||
|
||
[EnumMember(Value = "roaming")] | ||
Roaming, | ||
|
||
[EnumMember(Value = "not_roaming")] | ||
NotRoaming | ||
} | ||
} |
Oops, something went wrong.