diff --git a/CHANGES.md b/CHANGES.md index 0b4359117..102cf9fbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,24 @@ twilio-csharp Changelog ======================= +[2018-01-30] Version 5.9.5 +--------------------------- +**Api** +- Add `studio-engagements` usage key + +**Preview** +- Remove Studio Engagement Deletion + +**Studio** +- Initial Release + +**Video** +- [omit] Beta: Allow updates to `SubscribedTracks`. +- Add `SubscribedTracks`. +- Add track name to Video Recording resource +- Add Composition and Composition Media resources + + [2018-01-22] Version 5.9.4 --------------------------- **Library** diff --git a/src/Twilio/Rest/Api/V2010/Account/ApplicationOptions.cs b/src/Twilio/Rest/Api/V2010/Account/ApplicationOptions.cs index e49c0d342..a754eff91 100644 --- a/src/Twilio/Rest/Api/V2010/Account/ApplicationOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/ApplicationOptions.cs @@ -108,7 +108,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (VoiceMethod != null) @@ -118,7 +118,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceFallbackMethod != null) @@ -128,7 +128,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -143,7 +143,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (SmsMethod != null) @@ -153,7 +153,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsFallbackMethod != null) @@ -163,12 +163,12 @@ public List> GetParams() if (SmsStatusCallback != null) { - p.Add(new KeyValuePair("SmsStatusCallback", SmsStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsStatusCallback", Serializers.Url(SmsStatusCallback))); } if (MessageStatusCallback != null) { - p.Add(new KeyValuePair("MessageStatusCallback", MessageStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("MessageStatusCallback", Serializers.Url(MessageStatusCallback))); } return p; @@ -376,7 +376,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (VoiceMethod != null) @@ -386,7 +386,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceFallbackMethod != null) @@ -396,7 +396,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -411,7 +411,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (SmsMethod != null) @@ -421,7 +421,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsFallbackMethod != null) @@ -431,12 +431,12 @@ public List> GetParams() if (SmsStatusCallback != null) { - p.Add(new KeyValuePair("SmsStatusCallback", SmsStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsStatusCallback", Serializers.Url(SmsStatusCallback))); } if (MessageStatusCallback != null) { - p.Add(new KeyValuePair("MessageStatusCallback", MessageStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("MessageStatusCallback", Serializers.Url(MessageStatusCallback))); } return p; diff --git a/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryOptions.cs b/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryOptions.cs index e068481c4..d839180f5 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryOptions.cs @@ -75,7 +75,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/CallOptions.cs b/src/Twilio/Rest/Api/V2010/Account/CallOptions.cs index fdcf99195..f209aee85 100644 --- a/src/Twilio/Rest/Api/V2010/Account/CallOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/CallOptions.cs @@ -142,7 +142,7 @@ public List> GetParams() if (Url != null) { - p.Add(new KeyValuePair("Url", Url.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Url", Serializers.Url(Url))); } if (ApplicationSid != null) @@ -157,7 +157,7 @@ public List> GetParams() if (FallbackUrl != null) { - p.Add(new KeyValuePair("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackUrl", Serializers.Url(FallbackUrl))); } if (FallbackMethod != null) @@ -167,7 +167,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackEvent != null) @@ -488,7 +488,7 @@ public List> GetParams() var p = new List>(); if (Url != null) { - p.Add(new KeyValuePair("Url", Url.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Url", Serializers.Url(Url))); } if (Method != null) @@ -503,7 +503,7 @@ public List> GetParams() if (FallbackUrl != null) { - p.Add(new KeyValuePair("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackUrl", Serializers.Url(FallbackUrl))); } if (FallbackMethod != null) @@ -513,7 +513,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantOptions.cs b/src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantOptions.cs index 7a7c8eac1..a5d0b7638 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantOptions.cs @@ -122,7 +122,7 @@ public List> GetParams() if (HoldUrl != null) { - p.Add(new KeyValuePair("HoldUrl", HoldUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("HoldUrl", Serializers.Url(HoldUrl))); } if (HoldMethod != null) @@ -132,7 +132,7 @@ public List> GetParams() if (AnnounceUrl != null) { - p.Add(new KeyValuePair("AnnounceUrl", AnnounceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("AnnounceUrl", Serializers.Url(AnnounceUrl))); } if (AnnounceMethod != null) @@ -313,7 +313,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -358,7 +358,7 @@ public List> GetParams() if (WaitUrl != null) { - p.Add(new KeyValuePair("WaitUrl", WaitUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WaitUrl", Serializers.Url(WaitUrl))); } if (WaitMethod != null) @@ -388,7 +388,7 @@ public List> GetParams() if (ConferenceStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceStatusCallback", ConferenceStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceStatusCallback", Serializers.Url(ConferenceStatusCallback))); } if (ConferenceStatusCallbackMethod != null) @@ -408,7 +408,7 @@ public List> GetParams() if (RecordingStatusCallback != null) { - p.Add(new KeyValuePair("RecordingStatusCallback", RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("RecordingStatusCallback", Serializers.Url(RecordingStatusCallback))); } if (RecordingStatusCallbackMethod != null) @@ -433,7 +433,7 @@ public List> GetParams() if (ConferenceRecordingStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", ConferenceRecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", Serializers.Url(ConferenceRecordingStatusCallback))); } if (ConferenceRecordingStatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/ConnectAppOptions.cs b/src/Twilio/Rest/Api/V2010/Account/ConnectAppOptions.cs index 2af328613..34bf346de 100644 --- a/src/Twilio/Rest/Api/V2010/Account/ConnectAppOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/ConnectAppOptions.cs @@ -109,7 +109,7 @@ public List> GetParams() var p = new List>(); if (AuthorizeRedirectUrl != null) { - p.Add(new KeyValuePair("AuthorizeRedirectUrl", AuthorizeRedirectUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("AuthorizeRedirectUrl", Serializers.Url(AuthorizeRedirectUrl))); } if (CompanyName != null) @@ -124,7 +124,7 @@ public List> GetParams() if (DeauthorizeCallbackUrl != null) { - p.Add(new KeyValuePair("DeauthorizeCallbackUrl", DeauthorizeCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("DeauthorizeCallbackUrl", Serializers.Url(DeauthorizeCallbackUrl))); } if (Description != null) @@ -139,7 +139,7 @@ public List> GetParams() if (HomepageUrl != null) { - p.Add(new KeyValuePair("HomepageUrl", HomepageUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("HomepageUrl", Serializers.Url(HomepageUrl))); } if (Permissions != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalOptions.cs b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalOptions.cs index a93799c10..a74c27bf7 100644 --- a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalOptions.cs @@ -196,7 +196,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -206,12 +206,12 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -236,7 +236,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -246,7 +246,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (IdentitySid != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileOptions.cs b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileOptions.cs index a6fcf0caf..bdafba9c7 100644 --- a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileOptions.cs @@ -196,7 +196,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -206,12 +206,12 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -236,7 +236,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -246,7 +246,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (IdentitySid != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeOptions.cs b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeOptions.cs index a5ff2067c..604918934 100644 --- a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeOptions.cs @@ -196,7 +196,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -206,12 +206,12 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -236,7 +236,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -246,7 +246,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (IdentitySid != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberOptions.cs b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberOptions.cs index b11994073..4cea1f0f6 100644 --- a/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberOptions.cs @@ -155,7 +155,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -165,12 +165,12 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -195,7 +195,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -205,7 +205,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (EmergencyStatus != null) @@ -505,7 +505,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -515,12 +515,12 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -545,7 +545,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -555,7 +555,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (EmergencyStatus != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs b/src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs index aab74065d..47f2acef7 100644 --- a/src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs @@ -124,12 +124,12 @@ public List> GetParams() if (MediaUrl != null) { - p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", prop.AbsoluteUri.TrimEnd('/')))); + p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", Serializers.Url(prop)))); } if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (ApplicationSid != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/Queue/MemberOptions.cs b/src/Twilio/Rest/Api/V2010/Account/Queue/MemberOptions.cs index eb273fab9..b94f4ec43 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Queue/MemberOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Queue/MemberOptions.cs @@ -99,7 +99,7 @@ public List> GetParams() var p = new List>(); if (Url != null) { - p.Add(new KeyValuePair("Url", Url.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Url", Serializers.Url(Url))); } if (Method != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/ShortCodeOptions.cs b/src/Twilio/Rest/Api/V2010/Account/ShortCodeOptions.cs index fd9c27474..5d134ff56 100644 --- a/src/Twilio/Rest/Api/V2010/Account/ShortCodeOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/ShortCodeOptions.cs @@ -109,7 +109,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (SmsMethod != null) @@ -119,7 +119,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsFallbackMethod != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/Sip/DomainOptions.cs b/src/Twilio/Rest/Api/V2010/Account/Sip/DomainOptions.cs index 0fd4214b8..475c69a79 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Sip/DomainOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Sip/DomainOptions.cs @@ -118,7 +118,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (VoiceMethod != null) @@ -128,7 +128,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceFallbackMethod != null) @@ -138,7 +138,7 @@ public List> GetParams() if (VoiceStatusCallbackUrl != null) { - p.Add(new KeyValuePair("VoiceStatusCallbackUrl", VoiceStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceStatusCallbackUrl", Serializers.Url(VoiceStatusCallbackUrl))); } if (VoiceStatusCallbackMethod != null) @@ -270,7 +270,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -285,12 +285,12 @@ public List> GetParams() if (VoiceStatusCallbackUrl != null) { - p.Add(new KeyValuePair("VoiceStatusCallbackUrl", VoiceStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceStatusCallbackUrl", Serializers.Url(VoiceStatusCallbackUrl))); } if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } if (SipRegistration != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeResource.cs index 2a1a5a8bb..86358a815 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyResource.cs index 967e0b4d2..62b84a234 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthResource.cs index 72f0f969e..c34b54fb5 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyResource.cs index 81793738c..99291205e 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthResource.cs index bf53af2b6..a16f4955b 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayResource.cs index 537cbabbb..1754e9321 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyResource.cs index 5037e531d..3161163f7 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayResource.cs index 005399989..c28a5f76c 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/RecordResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/RecordResource.cs index 2b74a80bc..de7296d7b 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/RecordResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/RecordResource.cs @@ -186,6 +186,7 @@ public static implicit operator CategoryEnum(string value) public static readonly CategoryEnum SmsMessagesFeatures = new CategoryEnum("sms-messages-features"); public static readonly CategoryEnum SmsMessagesFeaturesSenderid = new CategoryEnum("sms-messages-features-senderid"); public static readonly CategoryEnum SpeechRecognition = new CategoryEnum("speech-recognition"); + public static readonly CategoryEnum StudioEngagements = new CategoryEnum("studio-engagements"); public static readonly CategoryEnum Sync = new CategoryEnum("sync"); public static readonly CategoryEnum SyncActions = new CategoryEnum("sync-actions"); public static readonly CategoryEnum SyncEndpointHours = new CategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerOptions.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerOptions.cs index 849516c77..9c53c7821 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerOptions.cs @@ -92,7 +92,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (FriendlyName != null) @@ -196,7 +196,7 @@ public List> GetParams() var p = new List>(); if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (TriggerValue != null) diff --git a/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerResource.cs b/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerResource.cs index 7eb0f1568..a8053b005 100644 --- a/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerResource.cs +++ b/src/Twilio/Rest/Api/V2010/Account/Usage/TriggerResource.cs @@ -186,6 +186,7 @@ public static implicit operator UsageCategoryEnum(string value) public static readonly UsageCategoryEnum SmsMessagesFeatures = new UsageCategoryEnum("sms-messages-features"); public static readonly UsageCategoryEnum SmsMessagesFeaturesSenderid = new UsageCategoryEnum("sms-messages-features-senderid"); public static readonly UsageCategoryEnum SpeechRecognition = new UsageCategoryEnum("speech-recognition"); + public static readonly UsageCategoryEnum StudioEngagements = new UsageCategoryEnum("studio-engagements"); public static readonly UsageCategoryEnum Sync = new UsageCategoryEnum("sync"); public static readonly UsageCategoryEnum SyncActions = new UsageCategoryEnum("sync-actions"); public static readonly UsageCategoryEnum SyncEndpointHours = new UsageCategoryEnum("sync-endpoint-hours"); diff --git a/src/Twilio/Rest/Api/V2010/Account/ValidationRequestOptions.cs b/src/Twilio/Rest/Api/V2010/Account/ValidationRequestOptions.cs index f15cb1620..9dda0d8d2 100644 --- a/src/Twilio/Rest/Api/V2010/Account/ValidationRequestOptions.cs +++ b/src/Twilio/Rest/Api/V2010/Account/ValidationRequestOptions.cs @@ -82,7 +82,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Chat/V1/ServiceOptions.cs b/src/Twilio/Rest/Chat/V1/ServiceOptions.cs index 64796d995..2eca82618 100644 --- a/src/Twilio/Rest/Chat/V1/ServiceOptions.cs +++ b/src/Twilio/Rest/Chat/V1/ServiceOptions.cs @@ -512,12 +512,12 @@ public List> GetParams() if (PreWebhookUrl != null) { - p.Add(new KeyValuePair("PreWebhookUrl", PreWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PreWebhookUrl", Serializers.Url(PreWebhookUrl))); } if (PostWebhookUrl != null) { - p.Add(new KeyValuePair("PostWebhookUrl", PostWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PostWebhookUrl", Serializers.Url(PostWebhookUrl))); } if (WebhookMethod != null) @@ -532,7 +532,7 @@ public List> GetParams() if (WebhooksOnMessageSendUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageSend.Url", WebhooksOnMessageSendUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageSend.Url", Serializers.Url(WebhooksOnMessageSendUrl))); } if (WebhooksOnMessageSendMethod != null) @@ -547,7 +547,7 @@ public List> GetParams() if (WebhooksOnMessageUpdateUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageUpdate.Url", WebhooksOnMessageUpdateUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageUpdate.Url", Serializers.Url(WebhooksOnMessageUpdateUrl))); } if (WebhooksOnMessageUpdateMethod != null) @@ -562,7 +562,7 @@ public List> GetParams() if (WebhooksOnMessageRemoveUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageRemove.Url", WebhooksOnMessageRemoveUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageRemove.Url", Serializers.Url(WebhooksOnMessageRemoveUrl))); } if (WebhooksOnMessageRemoveMethod != null) @@ -577,7 +577,7 @@ public List> GetParams() if (WebhooksOnChannelAddUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelAdd.Url", WebhooksOnChannelAddUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelAdd.Url", Serializers.Url(WebhooksOnChannelAddUrl))); } if (WebhooksOnChannelAddMethod != null) @@ -592,7 +592,7 @@ public List> GetParams() if (WebhooksOnChannelDestroyUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelDestroy.Url", WebhooksOnChannelDestroyUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelDestroy.Url", Serializers.Url(WebhooksOnChannelDestroyUrl))); } if (WebhooksOnChannelDestroyMethod != null) @@ -607,7 +607,7 @@ public List> GetParams() if (WebhooksOnChannelUpdateUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelUpdate.Url", WebhooksOnChannelUpdateUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelUpdate.Url", Serializers.Url(WebhooksOnChannelUpdateUrl))); } if (WebhooksOnChannelUpdateMethod != null) @@ -622,7 +622,7 @@ public List> GetParams() if (WebhooksOnMemberAddUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberAdd.Url", WebhooksOnMemberAddUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberAdd.Url", Serializers.Url(WebhooksOnMemberAddUrl))); } if (WebhooksOnMemberAddMethod != null) @@ -637,7 +637,7 @@ public List> GetParams() if (WebhooksOnMemberRemoveUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberRemove.Url", WebhooksOnMemberRemoveUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberRemove.Url", Serializers.Url(WebhooksOnMemberRemoveUrl))); } if (WebhooksOnMemberRemoveMethod != null) @@ -652,7 +652,7 @@ public List> GetParams() if (WebhooksOnMessageSentUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageSent.Url", WebhooksOnMessageSentUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageSent.Url", Serializers.Url(WebhooksOnMessageSentUrl))); } if (WebhooksOnMessageSentMethod != null) @@ -667,7 +667,7 @@ public List> GetParams() if (WebhooksOnMessageUpdatedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageUpdated.Url", WebhooksOnMessageUpdatedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageUpdated.Url", Serializers.Url(WebhooksOnMessageUpdatedUrl))); } if (WebhooksOnMessageUpdatedMethod != null) @@ -682,7 +682,7 @@ public List> GetParams() if (WebhooksOnMessageRemovedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageRemoved.Url", WebhooksOnMessageRemovedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageRemoved.Url", Serializers.Url(WebhooksOnMessageRemovedUrl))); } if (WebhooksOnMessageRemovedMethod != null) @@ -697,7 +697,7 @@ public List> GetParams() if (WebhooksOnChannelAddedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelAdded.Url", WebhooksOnChannelAddedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelAdded.Url", Serializers.Url(WebhooksOnChannelAddedUrl))); } if (WebhooksOnChannelAddedMethod != null) @@ -712,7 +712,7 @@ public List> GetParams() if (WebhooksOnChannelDestroyedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelDestroyed.Url", WebhooksOnChannelDestroyedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelDestroyed.Url", Serializers.Url(WebhooksOnChannelDestroyedUrl))); } if (WebhooksOnChannelDestroyedMethod != null) @@ -727,7 +727,7 @@ public List> GetParams() if (WebhooksOnChannelUpdatedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelUpdated.Url", WebhooksOnChannelUpdatedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelUpdated.Url", Serializers.Url(WebhooksOnChannelUpdatedUrl))); } if (WebhooksOnChannelUpdatedMethod != null) @@ -742,7 +742,7 @@ public List> GetParams() if (WebhooksOnMemberAddedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberAdded.Url", WebhooksOnMemberAddedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberAdded.Url", Serializers.Url(WebhooksOnMemberAddedUrl))); } if (WebhooksOnMemberAddedMethod != null) @@ -757,7 +757,7 @@ public List> GetParams() if (WebhooksOnMemberRemovedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberRemoved.Url", WebhooksOnMemberRemovedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberRemoved.Url", Serializers.Url(WebhooksOnMemberRemovedUrl))); } if (WebhooksOnMemberRemovedMethod != null) diff --git a/src/Twilio/Rest/Chat/V2/ServiceOptions.cs b/src/Twilio/Rest/Chat/V2/ServiceOptions.cs index 6c82638cd..e386e3ad9 100644 --- a/src/Twilio/Rest/Chat/V2/ServiceOptions.cs +++ b/src/Twilio/Rest/Chat/V2/ServiceOptions.cs @@ -381,12 +381,12 @@ public List> GetParams() if (PreWebhookUrl != null) { - p.Add(new KeyValuePair("PreWebhookUrl", PreWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PreWebhookUrl", Serializers.Url(PreWebhookUrl))); } if (PostWebhookUrl != null) { - p.Add(new KeyValuePair("PostWebhookUrl", PostWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PostWebhookUrl", Serializers.Url(PostWebhookUrl))); } if (WebhookMethod != null) diff --git a/src/Twilio/Rest/Domain.cs b/src/Twilio/Rest/Domain.cs index 0207d81cc..41f639b15 100644 --- a/src/Twilio/Rest/Domain.cs +++ b/src/Twilio/Rest/Domain.cs @@ -34,6 +34,7 @@ public static implicit operator Domain(string value) public static readonly Domain Messaging = new Domain("messaging"); public static readonly Domain Wireless = new Domain("wireless"); public static readonly Domain Sync = new Domain("sync"); + public static readonly Domain Studio = new Domain("studio"); } } \ No newline at end of file diff --git a/src/Twilio/Rest/Fax/V1/FaxOptions.cs b/src/Twilio/Rest/Fax/V1/FaxOptions.cs index b6b7d02b1..f1de4e46d 100644 --- a/src/Twilio/Rest/Fax/V1/FaxOptions.cs +++ b/src/Twilio/Rest/Fax/V1/FaxOptions.cs @@ -169,7 +169,7 @@ public List> GetParams() if (MediaUrl != null) { - p.Add(new KeyValuePair("MediaUrl", MediaUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("MediaUrl", Serializers.Url(MediaUrl))); } if (Quality != null) @@ -179,7 +179,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (From != null) diff --git a/src/Twilio/Rest/IpMessaging/V1/ServiceOptions.cs b/src/Twilio/Rest/IpMessaging/V1/ServiceOptions.cs index 2a819ef04..7d16dc504 100644 --- a/src/Twilio/Rest/IpMessaging/V1/ServiceOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V1/ServiceOptions.cs @@ -512,12 +512,12 @@ public List> GetParams() if (PreWebhookUrl != null) { - p.Add(new KeyValuePair("PreWebhookUrl", PreWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PreWebhookUrl", Serializers.Url(PreWebhookUrl))); } if (PostWebhookUrl != null) { - p.Add(new KeyValuePair("PostWebhookUrl", PostWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PostWebhookUrl", Serializers.Url(PostWebhookUrl))); } if (WebhookMethod != null) @@ -532,7 +532,7 @@ public List> GetParams() if (WebhooksOnMessageSendUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageSend.Url", WebhooksOnMessageSendUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageSend.Url", Serializers.Url(WebhooksOnMessageSendUrl))); } if (WebhooksOnMessageSendMethod != null) @@ -547,7 +547,7 @@ public List> GetParams() if (WebhooksOnMessageUpdateUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageUpdate.Url", WebhooksOnMessageUpdateUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageUpdate.Url", Serializers.Url(WebhooksOnMessageUpdateUrl))); } if (WebhooksOnMessageUpdateMethod != null) @@ -562,7 +562,7 @@ public List> GetParams() if (WebhooksOnMessageRemoveUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageRemove.Url", WebhooksOnMessageRemoveUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageRemove.Url", Serializers.Url(WebhooksOnMessageRemoveUrl))); } if (WebhooksOnMessageRemoveMethod != null) @@ -577,7 +577,7 @@ public List> GetParams() if (WebhooksOnChannelAddUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelAdd.Url", WebhooksOnChannelAddUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelAdd.Url", Serializers.Url(WebhooksOnChannelAddUrl))); } if (WebhooksOnChannelAddMethod != null) @@ -592,7 +592,7 @@ public List> GetParams() if (WebhooksOnChannelDestroyUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelDestroy.Url", WebhooksOnChannelDestroyUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelDestroy.Url", Serializers.Url(WebhooksOnChannelDestroyUrl))); } if (WebhooksOnChannelDestroyMethod != null) @@ -607,7 +607,7 @@ public List> GetParams() if (WebhooksOnChannelUpdateUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelUpdate.Url", WebhooksOnChannelUpdateUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelUpdate.Url", Serializers.Url(WebhooksOnChannelUpdateUrl))); } if (WebhooksOnChannelUpdateMethod != null) @@ -622,7 +622,7 @@ public List> GetParams() if (WebhooksOnMemberAddUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberAdd.Url", WebhooksOnMemberAddUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberAdd.Url", Serializers.Url(WebhooksOnMemberAddUrl))); } if (WebhooksOnMemberAddMethod != null) @@ -637,7 +637,7 @@ public List> GetParams() if (WebhooksOnMemberRemoveUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberRemove.Url", WebhooksOnMemberRemoveUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberRemove.Url", Serializers.Url(WebhooksOnMemberRemoveUrl))); } if (WebhooksOnMemberRemoveMethod != null) @@ -652,7 +652,7 @@ public List> GetParams() if (WebhooksOnMessageSentUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageSent.Url", WebhooksOnMessageSentUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageSent.Url", Serializers.Url(WebhooksOnMessageSentUrl))); } if (WebhooksOnMessageSentMethod != null) @@ -667,7 +667,7 @@ public List> GetParams() if (WebhooksOnMessageUpdatedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageUpdated.Url", WebhooksOnMessageUpdatedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageUpdated.Url", Serializers.Url(WebhooksOnMessageUpdatedUrl))); } if (WebhooksOnMessageUpdatedMethod != null) @@ -682,7 +682,7 @@ public List> GetParams() if (WebhooksOnMessageRemovedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMessageRemoved.Url", WebhooksOnMessageRemovedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMessageRemoved.Url", Serializers.Url(WebhooksOnMessageRemovedUrl))); } if (WebhooksOnMessageRemovedMethod != null) @@ -697,7 +697,7 @@ public List> GetParams() if (WebhooksOnChannelAddedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelAdded.Url", WebhooksOnChannelAddedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelAdded.Url", Serializers.Url(WebhooksOnChannelAddedUrl))); } if (WebhooksOnChannelAddedMethod != null) @@ -712,7 +712,7 @@ public List> GetParams() if (WebhooksOnChannelDestroyedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelDestroyed.Url", WebhooksOnChannelDestroyedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelDestroyed.Url", Serializers.Url(WebhooksOnChannelDestroyedUrl))); } if (WebhooksOnChannelDestroyedMethod != null) @@ -727,7 +727,7 @@ public List> GetParams() if (WebhooksOnChannelUpdatedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnChannelUpdated.Url", WebhooksOnChannelUpdatedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnChannelUpdated.Url", Serializers.Url(WebhooksOnChannelUpdatedUrl))); } if (WebhooksOnChannelUpdatedMethod != null) @@ -742,7 +742,7 @@ public List> GetParams() if (WebhooksOnMemberAddedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberAdded.Url", WebhooksOnMemberAddedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberAdded.Url", Serializers.Url(WebhooksOnMemberAddedUrl))); } if (WebhooksOnMemberAddedMethod != null) @@ -757,7 +757,7 @@ public List> GetParams() if (WebhooksOnMemberRemovedUrl != null) { - p.Add(new KeyValuePair("Webhooks.OnMemberRemoved.Url", WebhooksOnMemberRemovedUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("Webhooks.OnMemberRemoved.Url", Serializers.Url(WebhooksOnMemberRemovedUrl))); } if (WebhooksOnMemberRemovedMethod != null) diff --git a/src/Twilio/Rest/IpMessaging/V2/ServiceOptions.cs b/src/Twilio/Rest/IpMessaging/V2/ServiceOptions.cs index 931db9165..e19af0c33 100644 --- a/src/Twilio/Rest/IpMessaging/V2/ServiceOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V2/ServiceOptions.cs @@ -381,12 +381,12 @@ public List> GetParams() if (PreWebhookUrl != null) { - p.Add(new KeyValuePair("PreWebhookUrl", PreWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PreWebhookUrl", Serializers.Url(PreWebhookUrl))); } if (PostWebhookUrl != null) { - p.Add(new KeyValuePair("PostWebhookUrl", PostWebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("PostWebhookUrl", Serializers.Url(PostWebhookUrl))); } if (WebhookMethod != null) diff --git a/src/Twilio/Rest/Messaging/V1/ServiceOptions.cs b/src/Twilio/Rest/Messaging/V1/ServiceOptions.cs index 62d01a8fe..82b2fc076 100644 --- a/src/Twilio/Rest/Messaging/V1/ServiceOptions.cs +++ b/src/Twilio/Rest/Messaging/V1/ServiceOptions.cs @@ -97,7 +97,7 @@ public List> GetParams() if (InboundRequestUrl != null) { - p.Add(new KeyValuePair("InboundRequestUrl", InboundRequestUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("InboundRequestUrl", Serializers.Url(InboundRequestUrl))); } if (InboundMethod != null) @@ -107,7 +107,7 @@ public List> GetParams() if (FallbackUrl != null) { - p.Add(new KeyValuePair("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackUrl", Serializers.Url(FallbackUrl))); } if (FallbackMethod != null) @@ -117,7 +117,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StickySender != null) @@ -254,7 +254,7 @@ public List> GetParams() if (InboundRequestUrl != null) { - p.Add(new KeyValuePair("InboundRequestUrl", InboundRequestUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("InboundRequestUrl", Serializers.Url(InboundRequestUrl))); } if (InboundMethod != null) @@ -264,7 +264,7 @@ public List> GetParams() if (FallbackUrl != null) { - p.Add(new KeyValuePair("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackUrl", Serializers.Url(FallbackUrl))); } if (FallbackMethod != null) @@ -274,7 +274,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StickySender != null) diff --git a/src/Twilio/Rest/Preview/BulkExports/ExportConfigurationOptions.cs b/src/Twilio/Rest/Preview/BulkExports/ExportConfigurationOptions.cs index 40f00ddfe..126a125a5 100644 --- a/src/Twilio/Rest/Preview/BulkExports/ExportConfigurationOptions.cs +++ b/src/Twilio/Rest/Preview/BulkExports/ExportConfigurationOptions.cs @@ -90,7 +90,7 @@ public List> GetParams() if (WebhookUrl != null) { - p.Add(new KeyValuePair("WebhookUrl", WebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WebhookUrl", Serializers.Url(WebhookUrl))); } if (WebhookMethod != null) diff --git a/src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderOptions.cs b/src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderOptions.cs index 0ffb03309..fe726f192 100644 --- a/src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderOptions.cs +++ b/src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderOptions.cs @@ -395,7 +395,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (SmsMethod != null) @@ -405,7 +405,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsFallbackMethod != null) @@ -415,7 +415,7 @@ public List> GetParams() if (StatusCallbackUrl != null) { - p.Add(new KeyValuePair("StatusCallbackUrl", StatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallbackUrl", Serializers.Url(StatusCallbackUrl))); } if (StatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Preview/Proxy/Service/Session/Participant/MessageInteractionOptions.cs b/src/Twilio/Rest/Preview/Proxy/Service/Session/Participant/MessageInteractionOptions.cs index 17ccd8972..d3d6ade9f 100644 --- a/src/Twilio/Rest/Preview/Proxy/Service/Session/Participant/MessageInteractionOptions.cs +++ b/src/Twilio/Rest/Preview/Proxy/Service/Session/Participant/MessageInteractionOptions.cs @@ -68,7 +68,7 @@ public List> GetParams() if (MediaUrl != null) { - p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", prop.AbsoluteUri.TrimEnd('/')))); + p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", Serializers.Url(prop)))); } return p; diff --git a/src/Twilio/Rest/Preview/Proxy/ServiceOptions.cs b/src/Twilio/Rest/Preview/Proxy/ServiceOptions.cs index 496646fc4..57be2f275 100644 --- a/src/Twilio/Rest/Preview/Proxy/ServiceOptions.cs +++ b/src/Twilio/Rest/Preview/Proxy/ServiceOptions.cs @@ -105,7 +105,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } return p; @@ -196,7 +196,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } return p; diff --git a/src/Twilio/Rest/Preview/Studio/Flow/EngagementOptions.cs b/src/Twilio/Rest/Preview/Studio/Flow/EngagementOptions.cs index 9bd52ebba..ceed98ffa 100644 --- a/src/Twilio/Rest/Preview/Studio/Flow/EngagementOptions.cs +++ b/src/Twilio/Rest/Preview/Studio/Flow/EngagementOptions.cs @@ -149,42 +149,4 @@ public List> GetParams() } } - /// - /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you - /// currently do not have developer preview access, please contact help@twilio.com. - /// - /// Delete a specific Engagement. - /// - public class DeleteEngagementOptions : IOptions - { - /// - /// Flow Sid. - /// - public string PathFlowSid { get; } - /// - /// A string that uniquely identifies this Engagement. - /// - public string PathSid { get; } - - /// - /// Construct a new DeleteEngagementOptions - /// - /// Flow Sid. - /// A string that uniquely identifies this Engagement. - public DeleteEngagementOptions(string pathFlowSid, string pathSid) - { - PathFlowSid = pathFlowSid; - PathSid = pathSid; - } - - /// - /// Generate the necessary parameters - /// - public List> GetParams() - { - var p = new List>(); - return p; - } - } - } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/Studio/Flow/EngagementResource.cs b/src/Twilio/Rest/Preview/Studio/Flow/EngagementResource.cs index 812f22335..a625ddf29 100644 --- a/src/Twilio/Rest/Preview/Studio/Flow/EngagementResource.cs +++ b/src/Twilio/Rest/Preview/Studio/Flow/EngagementResource.cs @@ -326,76 +326,6 @@ public static async System.Threading.Tasks.Task CreateAsync( } #endif - private static Request BuildDeleteRequest(DeleteEngagementOptions options, ITwilioRestClient client) - { - return new Request( - HttpMethod.Delete, - Rest.Domain.Preview, - "/Studio/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathSid + "", - client.Region, - queryParams: options.GetParams() - ); - } - - /// - /// Delete a specific Engagement. - /// - /// Delete Engagement parameters - /// Client to make requests to Twilio - /// A single instance of Engagement - public static bool Delete(DeleteEngagementOptions options, ITwilioRestClient client = null) - { - client = client ?? TwilioClient.GetRestClient(); - var response = client.Request(BuildDeleteRequest(options, client)); - return response.StatusCode == System.Net.HttpStatusCode.NoContent; - } - - #if !NET35 - /// - /// Delete a specific Engagement. - /// - /// Delete Engagement parameters - /// Client to make requests to Twilio - /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task DeleteAsync(DeleteEngagementOptions options, - ITwilioRestClient client = null) - { - client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); - return response.StatusCode == System.Net.HttpStatusCode.NoContent; - } - #endif - - /// - /// Delete a specific Engagement. - /// - /// Flow Sid. - /// A string that uniquely identifies this Engagement. - /// Client to make requests to Twilio - /// A single instance of Engagement - public static bool Delete(string pathFlowSid, string pathSid, ITwilioRestClient client = null) - { - var options = new DeleteEngagementOptions(pathFlowSid, pathSid); - return Delete(options, client); - } - - #if !NET35 - /// - /// Delete a specific Engagement. - /// - /// Flow Sid. - /// A string that uniquely identifies this Engagement. - /// Client to make requests to Twilio - /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task DeleteAsync(string pathFlowSid, - string pathSid, - ITwilioRestClient client = null) - { - var options = new DeleteEngagementOptions(pathFlowSid, pathSid); - return await DeleteAsync(options, client); - } - #endif - /// /// Converts a JSON string into a EngagementResource object /// diff --git a/src/Twilio/Rest/Preview/Sync/ServiceOptions.cs b/src/Twilio/Rest/Preview/Sync/ServiceOptions.cs index 8c32f7853..3c5fc6407 100644 --- a/src/Twilio/Rest/Preview/Sync/ServiceOptions.cs +++ b/src/Twilio/Rest/Preview/Sync/ServiceOptions.cs @@ -113,7 +113,7 @@ public List> GetParams() if (WebhookUrl != null) { - p.Add(new KeyValuePair("WebhookUrl", WebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WebhookUrl", Serializers.Url(WebhookUrl))); } if (ReachabilityWebhooksEnabled != null) @@ -199,7 +199,7 @@ public List> GetParams() var p = new List>(); if (WebhookUrl != null) { - p.Add(new KeyValuePair("WebhookUrl", WebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WebhookUrl", Serializers.Url(WebhookUrl))); } if (FriendlyName != null) diff --git a/src/Twilio/Rest/Preview/Understand/Service/ModelBuildOptions.cs b/src/Twilio/Rest/Preview/Understand/Service/ModelBuildOptions.cs index f0ba4224e..da557e831 100644 --- a/src/Twilio/Rest/Preview/Understand/Service/ModelBuildOptions.cs +++ b/src/Twilio/Rest/Preview/Understand/Service/ModelBuildOptions.cs @@ -124,7 +124,7 @@ public List> GetParams() var p = new List>(); if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (UniqueName != null) diff --git a/src/Twilio/Rest/Preview/Wireless/CommandOptions.cs b/src/Twilio/Rest/Preview/Wireless/CommandOptions.cs index 945dda9d4..0b2d27852 100644 --- a/src/Twilio/Rest/Preview/Wireless/CommandOptions.cs +++ b/src/Twilio/Rest/Preview/Wireless/CommandOptions.cs @@ -177,7 +177,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (CommandMode != null) diff --git a/src/Twilio/Rest/Preview/Wireless/SimOptions.cs b/src/Twilio/Rest/Preview/Wireless/SimOptions.cs index 55eee17b5..daea435a3 100644 --- a/src/Twilio/Rest/Preview/Wireless/SimOptions.cs +++ b/src/Twilio/Rest/Preview/Wireless/SimOptions.cs @@ -216,7 +216,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (FriendlyName != null) @@ -241,7 +241,7 @@ public List> GetParams() if (CommandsCallbackUrl != null) { - p.Add(new KeyValuePair("CommandsCallbackUrl", CommandsCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CommandsCallbackUrl", Serializers.Url(CommandsCallbackUrl))); } if (SmsFallbackMethod != null) @@ -251,7 +251,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -261,7 +261,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (VoiceFallbackMethod != null) @@ -271,7 +271,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -281,7 +281,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } return p; diff --git a/src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionOptions.cs b/src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionOptions.cs index 30926eb8e..b9155eabd 100644 --- a/src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionOptions.cs +++ b/src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionOptions.cs @@ -67,7 +67,7 @@ public List> GetParams() if (MediaUrl != null) { - p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", prop.AbsoluteUri.TrimEnd('/')))); + p.AddRange(MediaUrl.Select(prop => new KeyValuePair("MediaUrl", Serializers.Url(prop)))); } return p; diff --git a/src/Twilio/Rest/Proxy/V1/ServiceOptions.cs b/src/Twilio/Rest/Proxy/V1/ServiceOptions.cs index fa45403ca..9b37cfa20 100644 --- a/src/Twilio/Rest/Proxy/V1/ServiceOptions.cs +++ b/src/Twilio/Rest/Proxy/V1/ServiceOptions.cs @@ -127,7 +127,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (GeoMatchLevel != null) @@ -142,12 +142,12 @@ public List> GetParams() if (InterceptCallbackUrl != null) { - p.Add(new KeyValuePair("InterceptCallbackUrl", InterceptCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("InterceptCallbackUrl", Serializers.Url(InterceptCallbackUrl))); } if (OutOfSessionCallbackUrl != null) { - p.Add(new KeyValuePair("OutOfSessionCallbackUrl", OutOfSessionCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("OutOfSessionCallbackUrl", Serializers.Url(OutOfSessionCallbackUrl))); } return p; @@ -252,7 +252,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (GeoMatchLevel != null) @@ -267,12 +267,12 @@ public List> GetParams() if (InterceptCallbackUrl != null) { - p.Add(new KeyValuePair("InterceptCallbackUrl", InterceptCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("InterceptCallbackUrl", Serializers.Url(InterceptCallbackUrl))); } if (OutOfSessionCallbackUrl != null) { - p.Add(new KeyValuePair("OutOfSessionCallbackUrl", OutOfSessionCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("OutOfSessionCallbackUrl", Serializers.Url(OutOfSessionCallbackUrl))); } return p; diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepOptions.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepOptions.cs new file mode 100644 index 000000000..d4719a8c7 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepOptions.cs @@ -0,0 +1,99 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement +{ + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// ReadStepOptions + /// + public class ReadStepOptions : ReadOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The engagement_sid + /// + public string PathEngagementSid { get; } + + /// + /// Construct a new ReadStepOptions + /// + /// The flow_sid + /// The engagement_sid + public ReadStepOptions(string pathFlowSid, string pathEngagementSid) + { + PathFlowSid = pathFlowSid; + PathEngagementSid = pathEngagementSid; + } + + /// + /// Generate the necessary parameters + /// + public override List> GetParams() + { + var p = new List>(); + if (PageSize != null) + { + p.Add(new KeyValuePair("PageSize", PageSize.ToString())); + } + + return p; + } + } + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// FetchStepOptions + /// + public class FetchStepOptions : IOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The engagement_sid + /// + public string PathEngagementSid { get; } + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new FetchStepOptions + /// + /// The flow_sid + /// The engagement_sid + /// The sid + public FetchStepOptions(string pathFlowSid, string pathEngagementSid, string pathSid) + { + PathFlowSid = pathFlowSid; + PathEngagementSid = pathEngagementSid; + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs new file mode 100644 index 000000000..33b6910f8 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs @@ -0,0 +1,324 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. +/// +/// StepResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement +{ + + public class StepResource : Resource + { + private static Request BuildReadRequest(ReadStepOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathEngagementSid + "/Steps", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// read + /// + /// Read Step parameters + /// Client to make requests to Twilio + /// A single instance of Step + public static ResourceSet Read(ReadStepOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildReadRequest(options, client)); + + var page = Page.FromJson("steps", response.Content); + return new ResourceSet(page, options, client); + } + + #if !NET35 + /// + /// read + /// + /// Read Step parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Step + public static async System.Threading.Tasks.Task> ReadAsync(ReadStepOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildReadRequest(options, client)); + + var page = Page.FromJson("steps", response.Content); + return new ResourceSet(page, options, client); + } + #endif + + /// + /// read + /// + /// The flow_sid + /// The engagement_sid + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// A single instance of Step + public static ResourceSet Read(string pathFlowSid, + string pathEngagementSid, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadStepOptions(pathFlowSid, pathEngagementSid){PageSize = pageSize, Limit = limit}; + return Read(options, client); + } + + #if !NET35 + /// + /// read + /// + /// The flow_sid + /// The engagement_sid + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Step + public static async System.Threading.Tasks.Task> ReadAsync(string pathFlowSid, + string pathEngagementSid, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadStepOptions(pathFlowSid, pathEngagementSid){PageSize = pageSize, Limit = limit}; + return await ReadAsync(options, client); + } + #endif + + /// + /// Fetch the target page of records + /// + /// API-generated URL for the requested results page + /// Client to make requests to Twilio + /// The target page of records + public static Page GetPage(string targetUrl, ITwilioRestClient client) + { + client = client ?? TwilioClient.GetRestClient(); + + var request = new Request( + HttpMethod.Get, + targetUrl + ); + + var response = client.Request(request); + return Page.FromJson("steps", response.Content); + } + + /// + /// Fetch the next page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The next page of records + public static Page NextPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetNextPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("steps", response.Content); + } + + /// + /// Fetch the previous page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The previous page of records + public static Page PreviousPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetPreviousPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("steps", response.Content); + } + + private static Request BuildFetchRequest(FetchStepOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathEngagementSid + "/Steps/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch Step parameters + /// Client to make requests to Twilio + /// A single instance of Step + public static StepResource Fetch(FetchStepOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch Step parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Step + public static async System.Threading.Tasks.Task FetchAsync(FetchStepOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// The sid + /// Client to make requests to Twilio + /// A single instance of Step + public static StepResource Fetch(string pathFlowSid, + string pathEngagementSid, + string pathSid, + ITwilioRestClient client = null) + { + var options = new FetchStepOptions(pathFlowSid, pathEngagementSid, pathSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Step + public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, + string pathEngagementSid, + string pathSid, + ITwilioRestClient client = null) + { + var options = new FetchStepOptions(pathFlowSid, pathEngagementSid, pathSid); + return await FetchAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a StepResource object + /// + /// Raw JSON string + /// StepResource object represented by the provided JSON + public static StepResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The sid + /// + [JsonProperty("sid")] + public string Sid { get; private set; } + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The flow_sid + /// + [JsonProperty("flow_sid")] + public string FlowSid { get; private set; } + /// + /// The engagement_sid + /// + [JsonProperty("engagement_sid")] + public string EngagementSid { get; private set; } + /// + /// The name + /// + [JsonProperty("name")] + public string Name { get; private set; } + /// + /// The context + /// + [JsonProperty("context")] + public object Context { get; private set; } + /// + /// The transitioned_from + /// + [JsonProperty("transitioned_from")] + public string TransitionedFrom { get; private set; } + /// + /// The transitioned_to + /// + [JsonProperty("transitioned_to")] + public string TransitionedTo { get; private set; } + /// + /// The date_created + /// + [JsonProperty("date_created")] + public DateTime? DateCreated { get; private set; } + /// + /// The date_updated + /// + [JsonProperty("date_updated")] + public DateTime? DateUpdated { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + + private StepResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/EngagementOptions.cs b/src/Twilio/Rest/Studio/V1/Flow/EngagementOptions.cs new file mode 100644 index 000000000..c14c1bab9 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/EngagementOptions.cs @@ -0,0 +1,149 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Studio.V1.Flow +{ + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// ReadEngagementOptions + /// + public class ReadEngagementOptions : ReadOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + + /// + /// Construct a new ReadEngagementOptions + /// + /// The flow_sid + public ReadEngagementOptions(string pathFlowSid) + { + PathFlowSid = pathFlowSid; + } + + /// + /// Generate the necessary parameters + /// + public override List> GetParams() + { + var p = new List>(); + if (PageSize != null) + { + p.Add(new KeyValuePair("PageSize", PageSize.ToString())); + } + + return p; + } + } + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// FetchEngagementOptions + /// + public class FetchEngagementOptions : IOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new FetchEngagementOptions + /// + /// The flow_sid + /// The sid + public FetchEngagementOptions(string pathFlowSid, string pathSid) + { + PathFlowSid = pathFlowSid; + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// CreateEngagementOptions + /// + public class CreateEngagementOptions : IOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The to + /// + public Types.PhoneNumber To { get; } + /// + /// The from + /// + public Types.PhoneNumber From { get; } + /// + /// The parameters + /// + public string Parameters { get; set; } + + /// + /// Construct a new CreateEngagementOptions + /// + /// The flow_sid + /// The to + /// The from + public CreateEngagementOptions(string pathFlowSid, Types.PhoneNumber to, Types.PhoneNumber from) + { + PathFlowSid = pathFlowSid; + To = to; + From = from; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + if (To != null) + { + p.Add(new KeyValuePair("To", To.ToString())); + } + + if (From != null) + { + p.Add(new KeyValuePair("From", From.ToString())); + } + + if (Parameters != null) + { + p.Add(new KeyValuePair("Parameters", Parameters)); + } + + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs new file mode 100644 index 000000000..553d5b6f0 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs @@ -0,0 +1,409 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. +/// +/// EngagementResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Types; + +namespace Twilio.Rest.Studio.V1.Flow +{ + + public class EngagementResource : Resource + { + public sealed class StatusEnum : StringEnum + { + private StatusEnum(string value) : base(value) {} + public StatusEnum() {} + public static implicit operator StatusEnum(string value) + { + return new StatusEnum(value); + } + + public static readonly StatusEnum Active = new StatusEnum("active"); + public static readonly StatusEnum Ended = new StatusEnum("ended"); + } + + private static Request BuildReadRequest(ReadEngagementOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// read + /// + /// Read Engagement parameters + /// Client to make requests to Twilio + /// A single instance of Engagement + public static ResourceSet Read(ReadEngagementOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildReadRequest(options, client)); + + var page = Page.FromJson("engagements", response.Content); + return new ResourceSet(page, options, client); + } + + #if !NET35 + /// + /// read + /// + /// Read Engagement parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task> ReadAsync(ReadEngagementOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildReadRequest(options, client)); + + var page = Page.FromJson("engagements", response.Content); + return new ResourceSet(page, options, client); + } + #endif + + /// + /// read + /// + /// The flow_sid + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// A single instance of Engagement + public static ResourceSet Read(string pathFlowSid, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadEngagementOptions(pathFlowSid){PageSize = pageSize, Limit = limit}; + return Read(options, client); + } + + #if !NET35 + /// + /// read + /// + /// The flow_sid + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task> ReadAsync(string pathFlowSid, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadEngagementOptions(pathFlowSid){PageSize = pageSize, Limit = limit}; + return await ReadAsync(options, client); + } + #endif + + /// + /// Fetch the target page of records + /// + /// API-generated URL for the requested results page + /// Client to make requests to Twilio + /// The target page of records + public static Page GetPage(string targetUrl, ITwilioRestClient client) + { + client = client ?? TwilioClient.GetRestClient(); + + var request = new Request( + HttpMethod.Get, + targetUrl + ); + + var response = client.Request(request); + return Page.FromJson("engagements", response.Content); + } + + /// + /// Fetch the next page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The next page of records + public static Page NextPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetNextPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("engagements", response.Content); + } + + /// + /// Fetch the previous page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The previous page of records + public static Page PreviousPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetPreviousPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("engagements", response.Content); + } + + private static Request BuildFetchRequest(FetchEngagementOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch Engagement parameters + /// Client to make requests to Twilio + /// A single instance of Engagement + public static EngagementResource Fetch(FetchEngagementOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch Engagement parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The flow_sid + /// The sid + /// Client to make requests to Twilio + /// A single instance of Engagement + public static EngagementResource Fetch(string pathFlowSid, string pathSid, ITwilioRestClient client = null) + { + var options = new FetchEngagementOptions(pathFlowSid, pathSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The flow_sid + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, + string pathSid, + ITwilioRestClient client = null) + { + var options = new FetchEngagementOptions(pathFlowSid, pathSid); + return await FetchAsync(options, client); + } + #endif + + private static Request BuildCreateRequest(CreateEngagementOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Post, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements", + client.Region, + postParams: options.GetParams() + ); + } + + /// + /// create + /// + /// Create Engagement parameters + /// Client to make requests to Twilio + /// A single instance of Engagement + public static EngagementResource Create(CreateEngagementOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildCreateRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// create + /// + /// Create Engagement parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task CreateAsync(CreateEngagementOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildCreateRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// create + /// + /// The flow_sid + /// The to + /// The from + /// The parameters + /// Client to make requests to Twilio + /// A single instance of Engagement + public static EngagementResource Create(string pathFlowSid, + Types.PhoneNumber to, + Types.PhoneNumber from, + string parameters = null, + ITwilioRestClient client = null) + { + var options = new CreateEngagementOptions(pathFlowSid, to, from){Parameters = parameters}; + return Create(options, client); + } + + #if !NET35 + /// + /// create + /// + /// The flow_sid + /// The to + /// The from + /// The parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Engagement + public static async System.Threading.Tasks.Task CreateAsync(string pathFlowSid, + Types.PhoneNumber to, + Types.PhoneNumber from, + string parameters = null, + ITwilioRestClient client = null) + { + var options = new CreateEngagementOptions(pathFlowSid, to, from){Parameters = parameters}; + return await CreateAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a EngagementResource object + /// + /// Raw JSON string + /// EngagementResource object represented by the provided JSON + public static EngagementResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The sid + /// + [JsonProperty("sid")] + public string Sid { get; private set; } + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The flow_sid + /// + [JsonProperty("flow_sid")] + public string FlowSid { get; private set; } + /// + /// The contact_sid + /// + [JsonProperty("contact_sid")] + public string ContactSid { get; private set; } + /// + /// The contact_channel_address + /// + [JsonProperty("contact_channel_address")] + public string ContactChannelAddress { get; private set; } + /// + /// The status + /// + [JsonProperty("status")] + [JsonConverter(typeof(StringEnumConverter))] + public EngagementResource.StatusEnum Status { get; private set; } + /// + /// The context + /// + [JsonProperty("context")] + public object Context { get; private set; } + /// + /// The date_created + /// + [JsonProperty("date_created")] + public DateTime? DateCreated { get; private set; } + /// + /// The date_updated + /// + [JsonProperty("date_updated")] + public DateTime? DateUpdated { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + /// + /// The links + /// + [JsonProperty("links")] + public Dictionary Links { get; private set; } + + private EngagementResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/FlowOptions.cs b/src/Twilio/Rest/Studio/V1/FlowOptions.cs new file mode 100644 index 000000000..2c7a1f0da --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/FlowOptions.cs @@ -0,0 +1,98 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Studio.V1 +{ + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// ReadFlowOptions + /// + public class ReadFlowOptions : ReadOptions + { + /// + /// Generate the necessary parameters + /// + public override List> GetParams() + { + var p = new List>(); + if (PageSize != null) + { + p.Add(new KeyValuePair("PageSize", PageSize.ToString())); + } + + return p; + } + } + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// FetchFlowOptions + /// + public class FetchFlowOptions : IOptions + { + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new FetchFlowOptions + /// + /// The sid + public FetchFlowOptions(string pathSid) + { + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// DeleteFlowOptions + /// + public class DeleteFlowOptions : IOptions + { + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new DeleteFlowOptions + /// + /// The sid + public DeleteFlowOptions(string pathSid) + { + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/FlowResource.cs b/src/Twilio/Rest/Studio/V1/FlowResource.cs new file mode 100644 index 000000000..1f1022ff4 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/FlowResource.cs @@ -0,0 +1,378 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. +/// +/// FlowResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Types; + +namespace Twilio.Rest.Studio.V1 +{ + + public class FlowResource : Resource + { + public sealed class StatusEnum : StringEnum + { + private StatusEnum(string value) : base(value) {} + public StatusEnum() {} + public static implicit operator StatusEnum(string value) + { + return new StatusEnum(value); + } + + public static readonly StatusEnum Draft = new StatusEnum("draft"); + public static readonly StatusEnum Published = new StatusEnum("published"); + } + + private static Request BuildReadRequest(ReadFlowOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// read + /// + /// Read Flow parameters + /// Client to make requests to Twilio + /// A single instance of Flow + public static ResourceSet Read(ReadFlowOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildReadRequest(options, client)); + + var page = Page.FromJson("flows", response.Content); + return new ResourceSet(page, options, client); + } + + #if !NET35 + /// + /// read + /// + /// Read Flow parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildReadRequest(options, client)); + + var page = Page.FromJson("flows", response.Content); + return new ResourceSet(page, options, client); + } + #endif + + /// + /// read + /// + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// A single instance of Flow + public static ResourceSet Read(int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadFlowOptions(){PageSize = pageSize, Limit = limit}; + return Read(options, client); + } + + #if !NET35 + /// + /// read + /// + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task> ReadAsync(int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadFlowOptions(){PageSize = pageSize, Limit = limit}; + return await ReadAsync(options, client); + } + #endif + + /// + /// Fetch the target page of records + /// + /// API-generated URL for the requested results page + /// Client to make requests to Twilio + /// The target page of records + public static Page GetPage(string targetUrl, ITwilioRestClient client) + { + client = client ?? TwilioClient.GetRestClient(); + + var request = new Request( + HttpMethod.Get, + targetUrl + ); + + var response = client.Request(request); + return Page.FromJson("flows", response.Content); + } + + /// + /// Fetch the next page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The next page of records + public static Page NextPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetNextPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("flows", response.Content); + } + + /// + /// Fetch the previous page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The previous page of records + public static Page PreviousPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetPreviousPageUrl( + Rest.Domain.Studio, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("flows", response.Content); + } + + private static Request BuildFetchRequest(FetchFlowOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch Flow parameters + /// Client to make requests to Twilio + /// A single instance of Flow + public static FlowResource Fetch(FetchFlowOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch Flow parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task FetchAsync(FetchFlowOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The sid + /// Client to make requests to Twilio + /// A single instance of Flow + public static FlowResource Fetch(string pathSid, ITwilioRestClient client = null) + { + var options = new FetchFlowOptions(pathSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, + ITwilioRestClient client = null) + { + var options = new FetchFlowOptions(pathSid); + return await FetchAsync(options, client); + } + #endif + + private static Request BuildDeleteRequest(DeleteFlowOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Delete, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// delete + /// + /// Delete Flow parameters + /// Client to make requests to Twilio + /// A single instance of Flow + public static bool Delete(DeleteFlowOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildDeleteRequest(options, client)); + return response.StatusCode == System.Net.HttpStatusCode.NoContent; + } + + #if !NET35 + /// + /// delete + /// + /// Delete Flow parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task DeleteAsync(DeleteFlowOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + return response.StatusCode == System.Net.HttpStatusCode.NoContent; + } + #endif + + /// + /// delete + /// + /// The sid + /// Client to make requests to Twilio + /// A single instance of Flow + public static bool Delete(string pathSid, ITwilioRestClient client = null) + { + var options = new DeleteFlowOptions(pathSid); + return Delete(options, client); + } + + #if !NET35 + /// + /// delete + /// + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Flow + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + { + var options = new DeleteFlowOptions(pathSid); + return await DeleteAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a FlowResource object + /// + /// Raw JSON string + /// FlowResource object represented by the provided JSON + public static FlowResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The sid + /// + [JsonProperty("sid")] + public string Sid { get; private set; } + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The friendly_name + /// + [JsonProperty("friendly_name")] + public string FriendlyName { get; private set; } + /// + /// The status + /// + [JsonProperty("status")] + [JsonConverter(typeof(StringEnumConverter))] + public FlowResource.StatusEnum Status { get; private set; } + /// + /// The version + /// + [JsonProperty("version")] + public int? Version { get; private set; } + /// + /// The date_created + /// + [JsonProperty("date_created")] + public DateTime? DateCreated { get; private set; } + /// + /// The date_updated + /// + [JsonProperty("date_updated")] + public DateTime? DateUpdated { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + /// + /// The links + /// + [JsonProperty("links")] + public Dictionary Links { get; private set; } + + private FlowResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Sync/V1/ServiceOptions.cs b/src/Twilio/Rest/Sync/V1/ServiceOptions.cs index 09dee9f34..7b35675fc 100644 --- a/src/Twilio/Rest/Sync/V1/ServiceOptions.cs +++ b/src/Twilio/Rest/Sync/V1/ServiceOptions.cs @@ -110,7 +110,7 @@ public List> GetParams() if (WebhookUrl != null) { - p.Add(new KeyValuePair("WebhookUrl", WebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WebhookUrl", Serializers.Url(WebhookUrl))); } if (ReachabilityWebhooksEnabled != null) @@ -194,7 +194,7 @@ public List> GetParams() var p = new List>(); if (WebhookUrl != null) { - p.Add(new KeyValuePair("WebhookUrl", WebhookUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WebhookUrl", Serializers.Url(WebhookUrl))); } if (FriendlyName != null) diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationOptions.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationOptions.cs index d033e13c0..f640ed703 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationOptions.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationOptions.cs @@ -380,7 +380,7 @@ public List> GetParams() if (DequeueStatusCallbackUrl != null) { - p.Add(new KeyValuePair("DequeueStatusCallbackUrl", DequeueStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("DequeueStatusCallbackUrl", Serializers.Url(DequeueStatusCallbackUrl))); } if (CallFrom != null) @@ -405,12 +405,12 @@ public List> GetParams() if (CallUrl != null) { - p.Add(new KeyValuePair("CallUrl", CallUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallUrl", Serializers.Url(CallUrl))); } if (CallStatusCallbackUrl != null) { - p.Add(new KeyValuePair("CallStatusCallbackUrl", CallStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallStatusCallbackUrl", Serializers.Url(CallStatusCallbackUrl))); } if (CallAccept != null) @@ -430,7 +430,7 @@ public List> GetParams() if (RedirectUrl != null) { - p.Add(new KeyValuePair("RedirectUrl", RedirectUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("RedirectUrl", Serializers.Url(RedirectUrl))); } if (To != null) @@ -445,7 +445,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -490,7 +490,7 @@ public List> GetParams() if (WaitUrl != null) { - p.Add(new KeyValuePair("WaitUrl", WaitUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WaitUrl", Serializers.Url(WaitUrl))); } if (WaitMethod != null) @@ -510,7 +510,7 @@ public List> GetParams() if (ConferenceStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceStatusCallback", ConferenceStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceStatusCallback", Serializers.Url(ConferenceStatusCallback))); } if (ConferenceStatusCallbackMethod != null) @@ -540,7 +540,7 @@ public List> GetParams() if (RecordingStatusCallback != null) { - p.Add(new KeyValuePair("RecordingStatusCallback", RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("RecordingStatusCallback", Serializers.Url(RecordingStatusCallback))); } if (RecordingStatusCallbackMethod != null) @@ -550,7 +550,7 @@ public List> GetParams() if (ConferenceRecordingStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", ConferenceRecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", Serializers.Url(ConferenceRecordingStatusCallback))); } if (ConferenceRecordingStatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationOptions.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationOptions.cs index 9c8fa0adb..edd07cd8d 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationOptions.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationOptions.cs @@ -380,7 +380,7 @@ public List> GetParams() if (DequeueStatusCallbackUrl != null) { - p.Add(new KeyValuePair("DequeueStatusCallbackUrl", DequeueStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("DequeueStatusCallbackUrl", Serializers.Url(DequeueStatusCallbackUrl))); } if (CallFrom != null) @@ -405,12 +405,12 @@ public List> GetParams() if (CallUrl != null) { - p.Add(new KeyValuePair("CallUrl", CallUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallUrl", Serializers.Url(CallUrl))); } if (CallStatusCallbackUrl != null) { - p.Add(new KeyValuePair("CallStatusCallbackUrl", CallStatusCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallStatusCallbackUrl", Serializers.Url(CallStatusCallbackUrl))); } if (CallAccept != null) @@ -430,7 +430,7 @@ public List> GetParams() if (RedirectUrl != null) { - p.Add(new KeyValuePair("RedirectUrl", RedirectUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("RedirectUrl", Serializers.Url(RedirectUrl))); } if (To != null) @@ -445,7 +445,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) @@ -490,7 +490,7 @@ public List> GetParams() if (WaitUrl != null) { - p.Add(new KeyValuePair("WaitUrl", WaitUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("WaitUrl", Serializers.Url(WaitUrl))); } if (WaitMethod != null) @@ -510,7 +510,7 @@ public List> GetParams() if (ConferenceStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceStatusCallback", ConferenceStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceStatusCallback", Serializers.Url(ConferenceStatusCallback))); } if (ConferenceStatusCallbackMethod != null) @@ -540,7 +540,7 @@ public List> GetParams() if (RecordingStatusCallback != null) { - p.Add(new KeyValuePair("RecordingStatusCallback", RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("RecordingStatusCallback", Serializers.Url(RecordingStatusCallback))); } if (RecordingStatusCallbackMethod != null) @@ -550,7 +550,7 @@ public List> GetParams() if (ConferenceRecordingStatusCallback != null) { - p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", ConferenceRecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("ConferenceRecordingStatusCallback", Serializers.Url(ConferenceRecordingStatusCallback))); } if (ConferenceRecordingStatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowOptions.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowOptions.cs index 71832b154..1407871da 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowOptions.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowOptions.cs @@ -104,12 +104,12 @@ public List> GetParams() if (AssignmentCallbackUrl != null) { - p.Add(new KeyValuePair("AssignmentCallbackUrl", AssignmentCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("AssignmentCallbackUrl", Serializers.Url(AssignmentCallbackUrl))); } if (FallbackAssignmentCallbackUrl != null) { - p.Add(new KeyValuePair("FallbackAssignmentCallbackUrl", FallbackAssignmentCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackAssignmentCallbackUrl", Serializers.Url(FallbackAssignmentCallbackUrl))); } if (Configuration != null) @@ -265,12 +265,12 @@ public List> GetParams() if (AssignmentCallbackUrl != null) { - p.Add(new KeyValuePair("AssignmentCallbackUrl", AssignmentCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("AssignmentCallbackUrl", Serializers.Url(AssignmentCallbackUrl))); } if (FallbackAssignmentCallbackUrl != null) { - p.Add(new KeyValuePair("FallbackAssignmentCallbackUrl", FallbackAssignmentCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("FallbackAssignmentCallbackUrl", Serializers.Url(FallbackAssignmentCallbackUrl))); } if (TaskReservationTimeout != null) diff --git a/src/Twilio/Rest/Taskrouter/V1/WorkspaceOptions.cs b/src/Twilio/Rest/Taskrouter/V1/WorkspaceOptions.cs index 37e7b5a9a..f55e469e5 100644 --- a/src/Twilio/Rest/Taskrouter/V1/WorkspaceOptions.cs +++ b/src/Twilio/Rest/Taskrouter/V1/WorkspaceOptions.cs @@ -100,7 +100,7 @@ public List> GetParams() if (EventCallbackUrl != null) { - p.Add(new KeyValuePair("EventCallbackUrl", EventCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("EventCallbackUrl", Serializers.Url(EventCallbackUrl))); } if (EventsFilter != null) @@ -214,7 +214,7 @@ public List> GetParams() if (EventCallbackUrl != null) { - p.Add(new KeyValuePair("EventCallbackUrl", EventCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("EventCallbackUrl", Serializers.Url(EventCallbackUrl))); } if (EventsFilter != null) diff --git a/src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlOptions.cs b/src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlOptions.cs index 1738d800e..0cd9f4423 100644 --- a/src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlOptions.cs +++ b/src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlOptions.cs @@ -163,7 +163,7 @@ public List> GetParams() if (SipUrl != null) { - p.Add(new KeyValuePair("SipUrl", SipUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SipUrl", Serializers.Url(SipUrl))); } return p; @@ -277,7 +277,7 @@ public List> GetParams() if (SipUrl != null) { - p.Add(new KeyValuePair("SipUrl", SipUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SipUrl", Serializers.Url(SipUrl))); } return p; diff --git a/src/Twilio/Rest/Trunking/V1/TrunkOptions.cs b/src/Twilio/Rest/Trunking/V1/TrunkOptions.cs index 25c8ebb9c..de27fdedb 100644 --- a/src/Twilio/Rest/Trunking/V1/TrunkOptions.cs +++ b/src/Twilio/Rest/Trunking/V1/TrunkOptions.cs @@ -117,7 +117,7 @@ public List> GetParams() if (DisasterRecoveryUrl != null) { - p.Add(new KeyValuePair("DisasterRecoveryUrl", DisasterRecoveryUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("DisasterRecoveryUrl", Serializers.Url(DisasterRecoveryUrl))); } if (DisasterRecoveryMethod != null) @@ -220,7 +220,7 @@ public List> GetParams() if (DisasterRecoveryUrl != null) { - p.Add(new KeyValuePair("DisasterRecoveryUrl", DisasterRecoveryUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("DisasterRecoveryUrl", Serializers.Url(DisasterRecoveryUrl))); } if (DisasterRecoveryMethod != null) diff --git a/src/Twilio/Rest/Video/V1/CompositionOptions.cs b/src/Twilio/Rest/Video/V1/CompositionOptions.cs new file mode 100644 index 000000000..5146b7d64 --- /dev/null +++ b/src/Twilio/Rest/Video/V1/CompositionOptions.cs @@ -0,0 +1,239 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using System.Linq; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Video.V1 +{ + + /// + /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you + /// currently do not have developer preview access, please contact help@twilio.com. + /// + /// FetchCompositionOptions + /// + public class FetchCompositionOptions : IOptions + { + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new FetchCompositionOptions + /// + /// The sid + public FetchCompositionOptions(string pathSid) + { + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + + /// + /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you + /// currently do not have developer preview access, please contact help@twilio.com. + /// + /// ReadCompositionOptions + /// + public class ReadCompositionOptions : ReadOptions + { + /// + /// The status + /// + public CompositionResource.StatusEnum Status { get; set; } + /// + /// The date_created_after + /// + public DateTime? DateCreatedAfter { get; set; } + /// + /// The date_created_before + /// + public DateTime? DateCreatedBefore { get; set; } + + /// + /// Generate the necessary parameters + /// + public override List> GetParams() + { + var p = new List>(); + if (Status != null) + { + p.Add(new KeyValuePair("Status", Status.ToString())); + } + + if (DateCreatedAfter != null) + { + p.Add(new KeyValuePair("DateCreatedAfter", Serializers.DateTimeIso8601(DateCreatedAfter))); + } + + if (DateCreatedBefore != null) + { + p.Add(new KeyValuePair("DateCreatedBefore", Serializers.DateTimeIso8601(DateCreatedBefore))); + } + + if (PageSize != null) + { + p.Add(new KeyValuePair("PageSize", PageSize.ToString())); + } + + return p; + } + } + + /// + /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you + /// currently do not have developer preview access, please contact help@twilio.com. + /// + /// DeleteCompositionOptions + /// + public class DeleteCompositionOptions : IOptions + { + /// + /// The sid + /// + public string PathSid { get; } + + /// + /// Construct a new DeleteCompositionOptions + /// + /// The sid + public DeleteCompositionOptions(string pathSid) + { + PathSid = pathSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + + /// + /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you + /// currently do not have developer preview access, please contact help@twilio.com. + /// + /// CreateCompositionOptions + /// + public class CreateCompositionOptions : IOptions + { + /// + /// The audio_sources + /// + public List AudioSources { get; set; } + /// + /// The video_sources + /// + public List VideoSources { get; set; } + /// + /// The video_layout + /// + public CompositionResource.VideoLayoutEnum VideoLayout { get; set; } + /// + /// The resolution + /// + public string Resolution { get; set; } + /// + /// The format + /// + public CompositionResource.FormatEnum Format { get; set; } + /// + /// The desired_bitrate + /// + public int? DesiredBitrate { get; set; } + /// + /// The desired_max_duration + /// + public int? DesiredMaxDuration { get; set; } + /// + /// The status_callback + /// + public Uri StatusCallback { get; set; } + /// + /// The status_callback_method + /// + public Twilio.Http.HttpMethod StatusCallbackMethod { get; set; } + + /// + /// Construct a new CreateCompositionOptions + /// + public CreateCompositionOptions() + { + AudioSources = new List(); + VideoSources = new List(); + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + if (AudioSources != null) + { + p.AddRange(AudioSources.Select(prop => new KeyValuePair("AudioSources", prop.ToString()))); + } + + if (VideoSources != null) + { + p.AddRange(VideoSources.Select(prop => new KeyValuePair("VideoSources", prop.ToString()))); + } + + if (VideoLayout != null) + { + p.Add(new KeyValuePair("VideoLayout", VideoLayout.ToString())); + } + + if (Resolution != null) + { + p.Add(new KeyValuePair("Resolution", Resolution)); + } + + if (Format != null) + { + p.Add(new KeyValuePair("Format", Format.ToString())); + } + + if (DesiredBitrate != null) + { + p.Add(new KeyValuePair("DesiredBitrate", DesiredBitrate.Value.ToString())); + } + + if (DesiredMaxDuration != null) + { + p.Add(new KeyValuePair("DesiredMaxDuration", DesiredMaxDuration.Value.ToString())); + } + + if (StatusCallback != null) + { + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); + } + + if (StatusCallbackMethod != null) + { + p.Add(new KeyValuePair("StatusCallbackMethod", StatusCallbackMethod.ToString())); + } + + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Video/V1/CompositionResource.cs b/src/Twilio/Rest/Video/V1/CompositionResource.cs new file mode 100644 index 000000000..009948b52 --- /dev/null +++ b/src/Twilio/Rest/Video/V1/CompositionResource.cs @@ -0,0 +1,561 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you +/// currently do not have developer preview access, please contact help@twilio.com. +/// +/// CompositionResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Types; + +namespace Twilio.Rest.Video.V1 +{ + + public class CompositionResource : Resource + { + public sealed class StatusEnum : StringEnum + { + private StatusEnum(string value) : base(value) {} + public StatusEnum() {} + public static implicit operator StatusEnum(string value) + { + return new StatusEnum(value); + } + + public static readonly StatusEnum Processing = new StatusEnum("processing"); + public static readonly StatusEnum Completed = new StatusEnum("completed"); + public static readonly StatusEnum Deleted = new StatusEnum("deleted"); + public static readonly StatusEnum Failed = new StatusEnum("failed"); + } + + public sealed class FormatEnum : StringEnum + { + private FormatEnum(string value) : base(value) {} + public FormatEnum() {} + public static implicit operator FormatEnum(string value) + { + return new FormatEnum(value); + } + + public static readonly FormatEnum Mka = new FormatEnum("mka"); + public static readonly FormatEnum Mp3 = new FormatEnum("mp3"); + public static readonly FormatEnum M4A = new FormatEnum("m4a"); + public static readonly FormatEnum Mkv = new FormatEnum("mkv"); + public static readonly FormatEnum Mp4 = new FormatEnum("mp4"); + public static readonly FormatEnum Webm = new FormatEnum("webm"); + } + + public sealed class VideoLayoutEnum : StringEnum + { + private VideoLayoutEnum(string value) : base(value) {} + public VideoLayoutEnum() {} + public static implicit operator VideoLayoutEnum(string value) + { + return new VideoLayoutEnum(value); + } + + public static readonly VideoLayoutEnum Grid = new VideoLayoutEnum("GRID"); + public static readonly VideoLayoutEnum Single = new VideoLayoutEnum("SINGLE"); + public static readonly VideoLayoutEnum Pip = new VideoLayoutEnum("PIP"); + } + + private static Request BuildFetchRequest(FetchCompositionOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Video, + "/v1/Compositions/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch Composition parameters + /// Client to make requests to Twilio + /// A single instance of Composition + public static CompositionResource Fetch(FetchCompositionOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch Composition parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The sid + /// Client to make requests to Twilio + /// A single instance of Composition + public static CompositionResource Fetch(string pathSid, ITwilioRestClient client = null) + { + var options = new FetchCompositionOptions(pathSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, + ITwilioRestClient client = null) + { + var options = new FetchCompositionOptions(pathSid); + return await FetchAsync(options, client); + } + #endif + + private static Request BuildReadRequest(ReadCompositionOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Video, + "/v1/Compositions", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// read + /// + /// Read Composition parameters + /// Client to make requests to Twilio + /// A single instance of Composition + public static ResourceSet Read(ReadCompositionOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildReadRequest(options, client)); + + var page = Page.FromJson("compositions", response.Content); + return new ResourceSet(page, options, client); + } + + #if !NET35 + /// + /// read + /// + /// Read Composition parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task> ReadAsync(ReadCompositionOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildReadRequest(options, client)); + + var page = Page.FromJson("compositions", response.Content); + return new ResourceSet(page, options, client); + } + #endif + + /// + /// read + /// + /// The status + /// The date_created_after + /// The date_created_before + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// A single instance of Composition + public static ResourceSet Read(CompositionResource.StatusEnum status = null, + DateTime? dateCreatedAfter = null, + DateTime? dateCreatedBefore = null, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadCompositionOptions(){Status = status, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, PageSize = pageSize, Limit = limit}; + return Read(options, client); + } + + #if !NET35 + /// + /// read + /// + /// The status + /// The date_created_after + /// The date_created_before + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task> ReadAsync(CompositionResource.StatusEnum status = null, + DateTime? dateCreatedAfter = null, + DateTime? dateCreatedBefore = null, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadCompositionOptions(){Status = status, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, PageSize = pageSize, Limit = limit}; + return await ReadAsync(options, client); + } + #endif + + /// + /// Fetch the target page of records + /// + /// API-generated URL for the requested results page + /// Client to make requests to Twilio + /// The target page of records + public static Page GetPage(string targetUrl, ITwilioRestClient client) + { + client = client ?? TwilioClient.GetRestClient(); + + var request = new Request( + HttpMethod.Get, + targetUrl + ); + + var response = client.Request(request); + return Page.FromJson("compositions", response.Content); + } + + /// + /// Fetch the next page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The next page of records + public static Page NextPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetNextPageUrl( + Rest.Domain.Video, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("compositions", response.Content); + } + + /// + /// Fetch the previous page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The previous page of records + public static Page PreviousPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetPreviousPageUrl( + Rest.Domain.Video, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("compositions", response.Content); + } + + private static Request BuildDeleteRequest(DeleteCompositionOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Delete, + Rest.Domain.Video, + "/v1/Compositions/" + options.PathSid + "", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// delete + /// + /// Delete Composition parameters + /// Client to make requests to Twilio + /// A single instance of Composition + public static bool Delete(DeleteCompositionOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildDeleteRequest(options, client)); + return response.StatusCode == System.Net.HttpStatusCode.NoContent; + } + + #if !NET35 + /// + /// delete + /// + /// Delete Composition parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCompositionOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + return response.StatusCode == System.Net.HttpStatusCode.NoContent; + } + #endif + + /// + /// delete + /// + /// The sid + /// Client to make requests to Twilio + /// A single instance of Composition + public static bool Delete(string pathSid, ITwilioRestClient client = null) + { + var options = new DeleteCompositionOptions(pathSid); + return Delete(options, client); + } + + #if !NET35 + /// + /// delete + /// + /// The sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + { + var options = new DeleteCompositionOptions(pathSid); + return await DeleteAsync(options, client); + } + #endif + + private static Request BuildCreateRequest(CreateCompositionOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Post, + Rest.Domain.Video, + "/v1/Compositions", + client.Region, + postParams: options.GetParams() + ); + } + + /// + /// create + /// + /// Create Composition parameters + /// Client to make requests to Twilio + /// A single instance of Composition + public static CompositionResource Create(CreateCompositionOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildCreateRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// create + /// + /// Create Composition parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildCreateRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// create + /// + /// The audio_sources + /// The video_sources + /// The video_layout + /// The resolution + /// The format + /// The desired_bitrate + /// The desired_max_duration + /// The status_callback + /// The status_callback_method + /// Client to make requests to Twilio + /// A single instance of Composition + public static CompositionResource Create(List audioSources = null, + List videoSources = null, + CompositionResource.VideoLayoutEnum videoLayout = null, + string resolution = null, + CompositionResource.FormatEnum format = null, + int? desiredBitrate = null, + int? desiredMaxDuration = null, + Uri statusCallback = null, + Twilio.Http.HttpMethod statusCallbackMethod = null, + ITwilioRestClient client = null) + { + var options = new CreateCompositionOptions(){AudioSources = audioSources, VideoSources = videoSources, VideoLayout = videoLayout, Resolution = resolution, Format = format, DesiredBitrate = desiredBitrate, DesiredMaxDuration = desiredMaxDuration, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod}; + return Create(options, client); + } + + #if !NET35 + /// + /// create + /// + /// The audio_sources + /// The video_sources + /// The video_layout + /// The resolution + /// The format + /// The desired_bitrate + /// The desired_max_duration + /// The status_callback + /// The status_callback_method + /// Client to make requests to Twilio + /// Task that resolves to A single instance of Composition + public static async System.Threading.Tasks.Task CreateAsync(List audioSources = null, + List videoSources = null, + CompositionResource.VideoLayoutEnum videoLayout = null, + string resolution = null, + CompositionResource.FormatEnum format = null, + int? desiredBitrate = null, + int? desiredMaxDuration = null, + Uri statusCallback = null, + Twilio.Http.HttpMethod statusCallbackMethod = null, + ITwilioRestClient client = null) + { + var options = new CreateCompositionOptions(){AudioSources = audioSources, VideoSources = videoSources, VideoLayout = videoLayout, Resolution = resolution, Format = format, DesiredBitrate = desiredBitrate, DesiredMaxDuration = desiredMaxDuration, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod}; + return await CreateAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a CompositionResource object + /// + /// Raw JSON string + /// CompositionResource object represented by the provided JSON + public static CompositionResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The status + /// + [JsonProperty("status")] + [JsonConverter(typeof(StringEnumConverter))] + public CompositionResource.StatusEnum Status { get; private set; } + /// + /// The date_created + /// + [JsonProperty("date_created")] + public DateTime? DateCreated { get; private set; } + /// + /// The date_completed + /// + [JsonProperty("date_completed")] + public string DateCompleted { get; private set; } + /// + /// The date_deleted + /// + [JsonProperty("date_deleted")] + public string DateDeleted { get; private set; } + /// + /// The sid + /// + [JsonProperty("sid")] + public string Sid { get; private set; } + /// + /// The audio_sources + /// + [JsonProperty("audio_sources")] + public List AudioSources { get; private set; } + /// + /// The video_sources + /// + [JsonProperty("video_sources")] + public List VideoSources { get; private set; } + /// + /// The video_layout + /// + [JsonProperty("video_layout")] + [JsonConverter(typeof(StringEnumConverter))] + public CompositionResource.VideoLayoutEnum VideoLayout { get; private set; } + /// + /// The resolution + /// + [JsonProperty("resolution")] + public string Resolution { get; private set; } + /// + /// The format + /// + [JsonProperty("format")] + [JsonConverter(typeof(StringEnumConverter))] + public CompositionResource.FormatEnum Format { get; private set; } + /// + /// The bitrate + /// + [JsonProperty("bitrate")] + public int? Bitrate { get; private set; } + /// + /// The size + /// + [JsonProperty("size")] + public int? Size { get; private set; } + /// + /// The duration + /// + [JsonProperty("duration")] + public int? Duration { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + /// + /// The links + /// + [JsonProperty("links")] + public Dictionary Links { get; private set; } + + private CompositionResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Video/V1/RecordingResource.cs b/src/Twilio/Rest/Video/V1/RecordingResource.cs index 1a6297a28..5ac340697 100644 --- a/src/Twilio/Rest/Video/V1/RecordingResource.cs +++ b/src/Twilio/Rest/Video/V1/RecordingResource.cs @@ -449,6 +449,11 @@ public static RecordingResource FromJson(string json) [JsonProperty("grouping_sids")] public object GroupingSids { get; private set; } /// + /// The track_name + /// + [JsonProperty("track_name")] + public string TrackName { get; private set; } + /// /// The links /// [JsonProperty("links")] diff --git a/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackOptions.cs b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackOptions.cs new file mode 100644 index 000000000..16f0f959e --- /dev/null +++ b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackOptions.cs @@ -0,0 +1,170 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Video.V1.Room.Participant +{ + + /// + /// ReadSubscribedTrackOptions + /// + public class ReadSubscribedTrackOptions : ReadOptions + { + /// + /// The room_sid + /// + public string PathRoomSid { get; } + /// + /// The subscriber_sid + /// + public string PathSubscriberSid { get; } + /// + /// The date_created_after + /// + public DateTime? DateCreatedAfter { get; set; } + /// + /// The date_created_before + /// + public DateTime? DateCreatedBefore { get; set; } + /// + /// The track + /// + public string Track { get; set; } + /// + /// The publisher + /// + public string Publisher { get; set; } + /// + /// The kind + /// + public SubscribedTrackResource.KindEnum Kind { get; set; } + + /// + /// Construct a new ReadSubscribedTrackOptions + /// + /// The room_sid + /// The subscriber_sid + public ReadSubscribedTrackOptions(string pathRoomSid, string pathSubscriberSid) + { + PathRoomSid = pathRoomSid; + PathSubscriberSid = pathSubscriberSid; + } + + /// + /// Generate the necessary parameters + /// + public override List> GetParams() + { + var p = new List>(); + if (DateCreatedAfter != null) + { + p.Add(new KeyValuePair("DateCreatedAfter", Serializers.DateTimeIso8601(DateCreatedAfter))); + } + + if (DateCreatedBefore != null) + { + p.Add(new KeyValuePair("DateCreatedBefore", Serializers.DateTimeIso8601(DateCreatedBefore))); + } + + if (Track != null) + { + p.Add(new KeyValuePair("Track", Track.ToString())); + } + + if (Publisher != null) + { + p.Add(new KeyValuePair("Publisher", Publisher.ToString())); + } + + if (Kind != null) + { + p.Add(new KeyValuePair("Kind", Kind.ToString())); + } + + if (PageSize != null) + { + p.Add(new KeyValuePair("PageSize", PageSize.ToString())); + } + + return p; + } + } + + /// + /// UpdateSubscribedTrackOptions + /// + public class UpdateSubscribedTrackOptions : IOptions + { + /// + /// The room_sid + /// + public string PathRoomSid { get; } + /// + /// The subscriber_sid + /// + public string PathSubscriberSid { get; } + /// + /// The track + /// + public string Track { get; set; } + /// + /// The publisher + /// + public string Publisher { get; set; } + /// + /// The kind + /// + public SubscribedTrackResource.KindEnum Kind { get; set; } + /// + /// The status + /// + public SubscribedTrackResource.StatusEnum Status { get; set; } + + /// + /// Construct a new UpdateSubscribedTrackOptions + /// + /// The room_sid + /// The subscriber_sid + public UpdateSubscribedTrackOptions(string pathRoomSid, string pathSubscriberSid) + { + PathRoomSid = pathRoomSid; + PathSubscriberSid = pathSubscriberSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + if (Track != null) + { + p.Add(new KeyValuePair("Track", Track.ToString())); + } + + if (Publisher != null) + { + p.Add(new KeyValuePair("Publisher", Publisher.ToString())); + } + + if (Kind != null) + { + p.Add(new KeyValuePair("Kind", Kind.ToString())); + } + + if (Status != null) + { + p.Add(new KeyValuePair("Status", Status.ToString())); + } + + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs new file mode 100644 index 000000000..0210a1baf --- /dev/null +++ b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs @@ -0,0 +1,375 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// SubscribedTrackResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Types; + +namespace Twilio.Rest.Video.V1.Room.Participant +{ + + public class SubscribedTrackResource : Resource + { + public sealed class KindEnum : StringEnum + { + private KindEnum(string value) : base(value) {} + public KindEnum() {} + public static implicit operator KindEnum(string value) + { + return new KindEnum(value); + } + + public static readonly KindEnum Audio = new KindEnum("audio"); + public static readonly KindEnum Video = new KindEnum("video"); + public static readonly KindEnum Data = new KindEnum("data"); + } + + public sealed class StatusEnum : StringEnum + { + private StatusEnum(string value) : base(value) {} + public StatusEnum() {} + public static implicit operator StatusEnum(string value) + { + return new StatusEnum(value); + } + + public static readonly StatusEnum Subscribe = new StatusEnum("subscribe"); + public static readonly StatusEnum Unsubscribe = new StatusEnum("unsubscribe"); + } + + private static Request BuildReadRequest(ReadSubscribedTrackOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Video, + "/v1/Rooms/" + options.PathRoomSid + "/Participants/" + options.PathSubscriberSid + "/SubscribedTracks", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// read + /// + /// Read SubscribedTrack parameters + /// Client to make requests to Twilio + /// A single instance of SubscribedTrack + public static ResourceSet Read(ReadSubscribedTrackOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildReadRequest(options, client)); + + var page = Page.FromJson("subscribed_tracks", response.Content); + return new ResourceSet(page, options, client); + } + + #if !NET35 + /// + /// read + /// + /// Read SubscribedTrack parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of SubscribedTrack + public static async System.Threading.Tasks.Task> ReadAsync(ReadSubscribedTrackOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildReadRequest(options, client)); + + var page = Page.FromJson("subscribed_tracks", response.Content); + return new ResourceSet(page, options, client); + } + #endif + + /// + /// read + /// + /// The room_sid + /// The subscriber_sid + /// The date_created_after + /// The date_created_before + /// The track + /// The publisher + /// The kind + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// A single instance of SubscribedTrack + public static ResourceSet Read(string pathRoomSid, + string pathSubscriberSid, + DateTime? dateCreatedAfter = null, + DateTime? dateCreatedBefore = null, + string track = null, + string publisher = null, + SubscribedTrackResource.KindEnum kind = null, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadSubscribedTrackOptions(pathRoomSid, pathSubscriberSid){DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, Track = track, Publisher = publisher, Kind = kind, PageSize = pageSize, Limit = limit}; + return Read(options, client); + } + + #if !NET35 + /// + /// read + /// + /// The room_sid + /// The subscriber_sid + /// The date_created_after + /// The date_created_before + /// The track + /// The publisher + /// The kind + /// Page size + /// Record limit + /// Client to make requests to Twilio + /// Task that resolves to A single instance of SubscribedTrack + public static async System.Threading.Tasks.Task> ReadAsync(string pathRoomSid, + string pathSubscriberSid, + DateTime? dateCreatedAfter = null, + DateTime? dateCreatedBefore = null, + string track = null, + string publisher = null, + SubscribedTrackResource.KindEnum kind = null, + int? pageSize = null, + long? limit = null, + ITwilioRestClient client = null) + { + var options = new ReadSubscribedTrackOptions(pathRoomSid, pathSubscriberSid){DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, Track = track, Publisher = publisher, Kind = kind, PageSize = pageSize, Limit = limit}; + return await ReadAsync(options, client); + } + #endif + + /// + /// Fetch the target page of records + /// + /// API-generated URL for the requested results page + /// Client to make requests to Twilio + /// The target page of records + public static Page GetPage(string targetUrl, ITwilioRestClient client) + { + client = client ?? TwilioClient.GetRestClient(); + + var request = new Request( + HttpMethod.Get, + targetUrl + ); + + var response = client.Request(request); + return Page.FromJson("subscribed_tracks", response.Content); + } + + /// + /// Fetch the next page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The next page of records + public static Page NextPage(Page page, ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetNextPageUrl( + Rest.Domain.Video, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("subscribed_tracks", response.Content); + } + + /// + /// Fetch the previous page of records + /// + /// current page of records + /// Client to make requests to Twilio + /// The previous page of records + public static Page PreviousPage(Page page, + ITwilioRestClient client) + { + var request = new Request( + HttpMethod.Get, + page.GetPreviousPageUrl( + Rest.Domain.Video, + client.Region + ) + ); + + var response = client.Request(request); + return Page.FromJson("subscribed_tracks", response.Content); + } + + private static Request BuildUpdateRequest(UpdateSubscribedTrackOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Post, + Rest.Domain.Video, + "/v1/Rooms/" + options.PathRoomSid + "/Participants/" + options.PathSubscriberSid + "/SubscribedTracks", + client.Region, + postParams: options.GetParams() + ); + } + + /// + /// update + /// + /// Update SubscribedTrack parameters + /// Client to make requests to Twilio + /// A single instance of SubscribedTrack + public static SubscribedTrackResource Update(UpdateSubscribedTrackOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildUpdateRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// update + /// + /// Update SubscribedTrack parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of SubscribedTrack + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSubscribedTrackOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// update + /// + /// The room_sid + /// The subscriber_sid + /// The track + /// The publisher + /// The kind + /// The status + /// Client to make requests to Twilio + /// A single instance of SubscribedTrack + public static SubscribedTrackResource Update(string pathRoomSid, + string pathSubscriberSid, + string track = null, + string publisher = null, + SubscribedTrackResource.KindEnum kind = null, + SubscribedTrackResource.StatusEnum status = null, + ITwilioRestClient client = null) + { + var options = new UpdateSubscribedTrackOptions(pathRoomSid, pathSubscriberSid){Track = track, Publisher = publisher, Kind = kind, Status = status}; + return Update(options, client); + } + + #if !NET35 + /// + /// update + /// + /// The room_sid + /// The subscriber_sid + /// The track + /// The publisher + /// The kind + /// The status + /// Client to make requests to Twilio + /// Task that resolves to A single instance of SubscribedTrack + public static async System.Threading.Tasks.Task UpdateAsync(string pathRoomSid, + string pathSubscriberSid, + string track = null, + string publisher = null, + SubscribedTrackResource.KindEnum kind = null, + SubscribedTrackResource.StatusEnum status = null, + ITwilioRestClient client = null) + { + var options = new UpdateSubscribedTrackOptions(pathRoomSid, pathSubscriberSid){Track = track, Publisher = publisher, Kind = kind, Status = status}; + return await UpdateAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a SubscribedTrackResource object + /// + /// Raw JSON string + /// SubscribedTrackResource object represented by the provided JSON + public static SubscribedTrackResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The sid + /// + [JsonProperty("sid")] + public string Sid { get; private set; } + /// + /// The room_sid + /// + [JsonProperty("room_sid")] + public string RoomSid { get; private set; } + /// + /// The name + /// + [JsonProperty("name")] + public string Name { get; private set; } + /// + /// The publisher_sid + /// + [JsonProperty("publisher_sid")] + public string PublisherSid { get; private set; } + /// + /// The subscriber_sid + /// + [JsonProperty("subscriber_sid")] + public string SubscriberSid { get; private set; } + /// + /// The date_created + /// + [JsonProperty("date_created")] + public DateTime? DateCreated { get; private set; } + /// + /// The date_updated + /// + [JsonProperty("date_updated")] + public DateTime? DateUpdated { get; private set; } + /// + /// The enabled + /// + [JsonProperty("enabled")] + public bool? Enabled { get; private set; } + /// + /// The kind + /// + [JsonProperty("kind")] + [JsonConverter(typeof(StringEnumConverter))] + public SubscribedTrackResource.KindEnum Kind { get; private set; } + + private SubscribedTrackResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Video/V1/RoomOptions.cs b/src/Twilio/Rest/Video/V1/RoomOptions.cs index cd64d6b0c..fb5381ea6 100644 --- a/src/Twilio/Rest/Video/V1/RoomOptions.cs +++ b/src/Twilio/Rest/Video/V1/RoomOptions.cs @@ -114,7 +114,7 @@ public List> GetParams() if (StatusCallback != null) { - p.Add(new KeyValuePair("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackMethod != null) diff --git a/src/Twilio/Rest/Wireless/V1/CommandOptions.cs b/src/Twilio/Rest/Wireless/V1/CommandOptions.cs index 8df7bbac4..260a4a5e4 100644 --- a/src/Twilio/Rest/Wireless/V1/CommandOptions.cs +++ b/src/Twilio/Rest/Wireless/V1/CommandOptions.cs @@ -156,7 +156,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (CommandMode != null) diff --git a/src/Twilio/Rest/Wireless/V1/SimOptions.cs b/src/Twilio/Rest/Wireless/V1/SimOptions.cs index 59e424ab5..bc74384f4 100644 --- a/src/Twilio/Rest/Wireless/V1/SimOptions.cs +++ b/src/Twilio/Rest/Wireless/V1/SimOptions.cs @@ -213,7 +213,7 @@ public List> GetParams() if (CallbackUrl != null) { - p.Add(new KeyValuePair("CallbackUrl", CallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CallbackUrl", Serializers.Url(CallbackUrl))); } if (FriendlyName != null) @@ -238,7 +238,7 @@ public List> GetParams() if (CommandsCallbackUrl != null) { - p.Add(new KeyValuePair("CommandsCallbackUrl", CommandsCallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("CommandsCallbackUrl", Serializers.Url(CommandsCallbackUrl))); } if (SmsFallbackMethod != null) @@ -248,7 +248,7 @@ public List> GetParams() if (SmsFallbackUrl != null) { - p.Add(new KeyValuePair("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl))); } if (SmsMethod != null) @@ -258,7 +258,7 @@ public List> GetParams() if (SmsUrl != null) { - p.Add(new KeyValuePair("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("SmsUrl", Serializers.Url(SmsUrl))); } if (VoiceFallbackMethod != null) @@ -268,7 +268,7 @@ public List> GetParams() if (VoiceFallbackUrl != null) { - p.Add(new KeyValuePair("VoiceFallbackUrl", VoiceFallbackUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl))); } if (VoiceMethod != null) @@ -278,7 +278,7 @@ public List> GetParams() if (VoiceUrl != null) { - p.Add(new KeyValuePair("VoiceUrl", VoiceUrl.AbsoluteUri.TrimEnd('/'))); + p.Add(new KeyValuePair("VoiceUrl", Serializers.Url(VoiceUrl))); } return p; diff --git a/src/Twilio/TwiML/Fax/Receive.cs b/src/Twilio/TwiML/Fax/Receive.cs index 821a24082..0fb798fc7 100644 --- a/src/Twilio/TwiML/Fax/Receive.cs +++ b/src/Twilio/TwiML/Fax/Receive.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Fax { @@ -45,7 +46,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { diff --git a/src/Twilio/TwiML/FaxResponse.cs b/src/Twilio/TwiML/FaxResponse.cs index 2d8dbee07..ebdef7595 100644 --- a/src/Twilio/TwiML/FaxResponse.cs +++ b/src/Twilio/TwiML/FaxResponse.cs @@ -7,6 +7,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.TwiML.Fax; namespace Twilio.TwiML diff --git a/src/Twilio/TwiML/Messaging/Media.cs b/src/Twilio/TwiML/Messaging/Media.cs index 6795cd4a8..c76d651ce 100644 --- a/src/Twilio/TwiML/Messaging/Media.cs +++ b/src/Twilio/TwiML/Messaging/Media.cs @@ -7,6 +7,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Messaging { @@ -35,7 +36,7 @@ public Media(Uri url = null) : base("Media") /// protected override string GetElementBody() { - return this.Url != null ? this.Url.AbsoluteUri.TrimEnd('/') : string.Empty; + return this.Url != null ? Serializers.Url(this.Url) : string.Empty; } /// diff --git a/src/Twilio/TwiML/Messaging/Message.cs b/src/Twilio/TwiML/Messaging/Message.cs index 7a1e16571..4b5d92d10 100644 --- a/src/Twilio/TwiML/Messaging/Message.cs +++ b/src/Twilio/TwiML/Messaging/Message.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Messaging { @@ -90,7 +91,7 @@ protected override List GetElementAttributes() } if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -98,7 +99,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } return attributes; } diff --git a/src/Twilio/TwiML/Messaging/Redirect.cs b/src/Twilio/TwiML/Messaging/Redirect.cs index 51a200227..efa2bd46a 100644 --- a/src/Twilio/TwiML/Messaging/Redirect.cs +++ b/src/Twilio/TwiML/Messaging/Redirect.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Messaging { @@ -42,7 +43,7 @@ public Redirect(Uri url = null, Twilio.Http.HttpMethod method = null) : base("Re /// protected override string GetElementBody() { - return this.Url != null ? this.Url.AbsoluteUri.TrimEnd('/') : string.Empty; + return this.Url != null ? Serializers.Url(this.Url) : string.Empty; } /// diff --git a/src/Twilio/TwiML/MessagingResponse.cs b/src/Twilio/TwiML/MessagingResponse.cs index b1ed36b14..e013a4b6a 100644 --- a/src/Twilio/TwiML/MessagingResponse.cs +++ b/src/Twilio/TwiML/MessagingResponse.cs @@ -7,6 +7,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.TwiML.Messaging; namespace Twilio.TwiML diff --git a/src/Twilio/TwiML/Voice/Client.cs b/src/Twilio/TwiML/Voice/Client.cs index 3ff356752..6f54f5a21 100644 --- a/src/Twilio/TwiML/Voice/Client.cs +++ b/src/Twilio/TwiML/Voice/Client.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -99,7 +100,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Url != null) { - attributes.Add(new XAttribute("url", this.Url.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("url", Serializers.Url(this.Url))); } if (this.Method != null) { @@ -111,7 +112,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } if (this.StatusCallbackMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Conference.cs b/src/Twilio/TwiML/Voice/Conference.cs index 13228a510..87080ceee 100644 --- a/src/Twilio/TwiML/Voice/Conference.cs +++ b/src/Twilio/TwiML/Voice/Conference.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -284,7 +285,7 @@ protected override List GetElementAttributes() } if (this.WaitUrl != null) { - attributes.Add(new XAttribute("waitUrl", this.WaitUrl.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("waitUrl", Serializers.Url(this.WaitUrl))); } if (this.WaitMethod != null) { @@ -316,7 +317,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } if (this.StatusCallbackMethod != null) { @@ -324,7 +325,7 @@ protected override List GetElementAttributes() } if (this.RecordingStatusCallback != null) { - attributes.Add(new XAttribute("recordingStatusCallback", this.RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("recordingStatusCallback", Serializers.Url(this.RecordingStatusCallback))); } if (this.RecordingStatusCallbackMethod != null) { @@ -336,7 +337,7 @@ protected override List GetElementAttributes() } if (this.EventCallbackUrl != null) { - attributes.Add(new XAttribute("eventCallbackUrl", this.EventCallbackUrl.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("eventCallbackUrl", Serializers.Url(this.EventCallbackUrl))); } return attributes; } diff --git a/src/Twilio/TwiML/Voice/Dial.cs b/src/Twilio/TwiML/Voice/Dial.cs index 4e789ca81..d9ec2f01f 100644 --- a/src/Twilio/TwiML/Voice/Dial.cs +++ b/src/Twilio/TwiML/Voice/Dial.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -236,7 +237,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -268,7 +269,7 @@ protected override List GetElementAttributes() } if (this.RecordingStatusCallback != null) { - attributes.Add(new XAttribute("recordingStatusCallback", this.RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("recordingStatusCallback", Serializers.Url(this.RecordingStatusCallback))); } if (this.RecordingStatusCallbackMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Enqueue.cs b/src/Twilio/TwiML/Voice/Enqueue.cs index 49a14c952..3241733c1 100644 --- a/src/Twilio/TwiML/Voice/Enqueue.cs +++ b/src/Twilio/TwiML/Voice/Enqueue.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Voice { @@ -82,7 +83,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -90,7 +91,7 @@ protected override List GetElementAttributes() } if (this.WaitUrl != null) { - attributes.Add(new XAttribute("waitUrl", this.WaitUrl.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("waitUrl", Serializers.Url(this.WaitUrl))); } if (this.WaitUrlMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Gather.cs b/src/Twilio/TwiML/Voice/Gather.cs index 3afdc8d7b..134adf088 100644 --- a/src/Twilio/TwiML/Voice/Gather.cs +++ b/src/Twilio/TwiML/Voice/Gather.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -250,7 +251,7 @@ protected override List GetElementAttributes() } if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -282,7 +283,7 @@ protected override List GetElementAttributes() } if (this.PartialResultCallback != null) { - attributes.Add(new XAttribute("partialResultCallback", this.PartialResultCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("partialResultCallback", Serializers.Url(this.PartialResultCallback))); } if (this.PartialResultCallbackMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Number.cs b/src/Twilio/TwiML/Voice/Number.cs index a30bb841d..8bdc937b1 100644 --- a/src/Twilio/TwiML/Voice/Number.cs +++ b/src/Twilio/TwiML/Voice/Number.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -110,7 +111,7 @@ protected override List GetElementAttributes() } if (this.Url != null) { - attributes.Add(new XAttribute("url", this.Url.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("url", Serializers.Url(this.Url))); } if (this.Method != null) { @@ -122,7 +123,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } if (this.StatusCallbackMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Play.cs b/src/Twilio/TwiML/Voice/Play.cs index e705de475..7b0ea9174 100644 --- a/src/Twilio/TwiML/Voice/Play.cs +++ b/src/Twilio/TwiML/Voice/Play.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Voice { @@ -48,7 +49,7 @@ public Play(Uri url = null, int? loop = null, string digits = null) : base("Play /// protected override string GetElementBody() { - return this.Url != null ? this.Url.AbsoluteUri.TrimEnd('/') : string.Empty; + return this.Url != null ? Serializers.Url(this.Url) : string.Empty; } /// diff --git a/src/Twilio/TwiML/Voice/Queue.cs b/src/Twilio/TwiML/Voice/Queue.cs index d2d603171..87d4998f9 100644 --- a/src/Twilio/TwiML/Voice/Queue.cs +++ b/src/Twilio/TwiML/Voice/Queue.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Voice { @@ -75,7 +76,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Url != null) { - attributes.Add(new XAttribute("url", this.Url.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("url", Serializers.Url(this.Url))); } if (this.Method != null) { diff --git a/src/Twilio/TwiML/Voice/Record.cs b/src/Twilio/TwiML/Voice/Record.cs index 5aa4235d4..334519df9 100644 --- a/src/Twilio/TwiML/Voice/Record.cs +++ b/src/Twilio/TwiML/Voice/Record.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -123,7 +124,7 @@ protected override List GetElementAttributes() var attributes = new List(); if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -151,7 +152,7 @@ protected override List GetElementAttributes() } if (this.RecordingStatusCallback != null) { - attributes.Add(new XAttribute("recordingStatusCallback", this.RecordingStatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("recordingStatusCallback", Serializers.Url(this.RecordingStatusCallback))); } if (this.RecordingStatusCallbackMethod != null) { @@ -163,7 +164,7 @@ protected override List GetElementAttributes() } if (this.TranscribeCallback != null) { - attributes.Add(new XAttribute("transcribeCallback", this.TranscribeCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("transcribeCallback", Serializers.Url(this.TranscribeCallback))); } return attributes; } diff --git a/src/Twilio/TwiML/Voice/Redirect.cs b/src/Twilio/TwiML/Voice/Redirect.cs index c89ea03b5..3491f2e10 100644 --- a/src/Twilio/TwiML/Voice/Redirect.cs +++ b/src/Twilio/TwiML/Voice/Redirect.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Voice { @@ -42,7 +43,7 @@ public Redirect(Uri url = null, Twilio.Http.HttpMethod method = null) : base("Re /// protected override string GetElementBody() { - return this.Url != null ? this.Url.AbsoluteUri.TrimEnd('/') : string.Empty; + return this.Url != null ? Serializers.Url(this.Url) : string.Empty; } /// diff --git a/src/Twilio/TwiML/Voice/Sip.cs b/src/Twilio/TwiML/Voice/Sip.cs index 420573887..722774081 100644 --- a/src/Twilio/TwiML/Voice/Sip.cs +++ b/src/Twilio/TwiML/Voice/Sip.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.Types; namespace Twilio.TwiML.Voice @@ -102,7 +103,7 @@ public Sip(Uri sipUrl = null, /// protected override string GetElementBody() { - return this.SipUrl != null ? this.SipUrl.AbsoluteUri.TrimEnd('/') : string.Empty; + return this.SipUrl != null ? Serializers.Url(this.SipUrl) : string.Empty; } /// @@ -121,7 +122,7 @@ protected override List GetElementAttributes() } if (this.Url != null) { - attributes.Add(new XAttribute("url", this.Url.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("url", Serializers.Url(this.Url))); } if (this.Method != null) { @@ -133,7 +134,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } if (this.StatusCallbackMethod != null) { diff --git a/src/Twilio/TwiML/Voice/Sms.cs b/src/Twilio/TwiML/Voice/Sms.cs index cd9b37f2f..0fea335a0 100644 --- a/src/Twilio/TwiML/Voice/Sms.cs +++ b/src/Twilio/TwiML/Voice/Sms.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; namespace Twilio.TwiML.Voice { @@ -90,7 +91,7 @@ protected override List GetElementAttributes() } if (this.Action != null) { - attributes.Add(new XAttribute("action", this.Action.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("action", Serializers.Url(this.Action))); } if (this.Method != null) { @@ -98,7 +99,7 @@ protected override List GetElementAttributes() } if (this.StatusCallback != null) { - attributes.Add(new XAttribute("statusCallback", this.StatusCallback.AbsoluteUri.TrimEnd('/'))); + attributes.Add(new XAttribute("statusCallback", Serializers.Url(this.StatusCallback))); } return attributes; } diff --git a/src/Twilio/TwiML/VoiceResponse.cs b/src/Twilio/TwiML/VoiceResponse.cs index 6e9a308ae..d3a7bf7b2 100644 --- a/src/Twilio/TwiML/VoiceResponse.cs +++ b/src/Twilio/TwiML/VoiceResponse.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using System.Xml.Linq; +using Twilio.Converters; using Twilio.TwiML.Voice; namespace Twilio.TwiML diff --git a/test/Twilio.Test/Rest/Preview/Studio/Flow/EngagementResourceTest.cs b/test/Twilio.Test/Rest/Preview/Studio/Flow/EngagementResourceTest.cs index d72812c29..65b789f75 100644 --- a/test/Twilio.Test/Rest/Preview/Studio/Flow/EngagementResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/Studio/Flow/EngagementResourceTest.cs @@ -129,42 +129,6 @@ public void TestCreateResponse() var response = EngagementResource.Create("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", new Twilio.Types.PhoneNumber("+15017122661"), new Twilio.Types.PhoneNumber("+15017122661"), client: twilioRestClient); Assert.NotNull(response); } - - [Test] - public void TestDeleteRequest() - { - var twilioRestClient = Substitute.For(); - var request = new Request( - HttpMethod.Delete, - Twilio.Rest.Domain.Preview, - "/Studio/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "" - ); - twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); - - try - { - EngagementResource.Delete("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); - Assert.Fail("Expected TwilioException to be thrown for 500"); - } - catch (ApiException) {} - twilioRestClient.Received().Request(request); - } - - [Test] - public void TestDeleteResponse() - { - var twilioRestClient = Substitute.For(); - twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - twilioRestClient.Request(Arg.Any()) - .Returns(new Response( - System.Net.HttpStatusCode.NoContent, - "null" - )); - - var response = EngagementResource.Delete("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); - Assert.NotNull(response); - } } } \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs new file mode 100644 index 000000000..1951d5dde --- /dev/null +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs @@ -0,0 +1,96 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Studio.V1.Flow.Engagement; + +namespace Twilio.Tests.Rest.Studio.V1.Flow.Engagement +{ + + [TestFixture] + public class StepTest : TwilioTest + { + [Test] + public void TestReadRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + StepResource.Read("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestReadEmptyResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"meta\": {\"previous_page_url\": null,\"next_page_url\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps?PageSize=50&Page=0\",\"page\": 0,\"first_page_url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps?PageSize=50&Page=0\",\"page_size\": 50,\"key\": \"steps\"},\"steps\": []}" + )); + + var response = StepResource.Read("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + StepResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"sid\": \"FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"engagement_sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"name\": \"incomingRequest\",\"context\": {},\"transitioned_from\": \"Trigger\",\"transitioned_to\": \"Ended\",\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" + )); + + var response = StepResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs new file mode 100644 index 000000000..71745a075 --- /dev/null +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs @@ -0,0 +1,134 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Studio.V1.Flow; + +namespace Twilio.Tests.Rest.Studio.V1.Flow +{ + + [TestFixture] + public class EngagementTest : TwilioTest + { + [Test] + public void TestReadRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + EngagementResource.Read("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestReadEmptyResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"meta\": {\"previous_page_url\": null,\"next_page_url\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements?PageSize=50&Page=0\",\"page\": 0,\"first_page_url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements?PageSize=50&Page=0\",\"page_size\": 50,\"key\": \"engagements\"},\"engagements\": []}" + )); + + var response = EngagementResource.Read("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + EngagementResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+14155555555\",\"status\": \"ended\",\"context\": {},\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\"}}" + )); + + var response = EngagementResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestCreateRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Post, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements", + "" + ); + request.AddPostParam("To", Serialize(new Twilio.Types.PhoneNumber("+15017122661"))); + request.AddPostParam("From", Serialize(new Twilio.Types.PhoneNumber("+15017122661"))); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + EngagementResource.Create("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", new Twilio.Types.PhoneNumber("+15017122661"), new Twilio.Types.PhoneNumber("+15017122661"), client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestCreateResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.Created, + "{\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"context\": {\"flow\": {\"first_name\": \"Foo\"}},\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+18001234567\",\"status\": \"active\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\"}}" + )); + + var response = EngagementResource.Create("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", new Twilio.Types.PhoneNumber("+15017122661"), new Twilio.Types.PhoneNumber("+15017122661"), client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Studio/V1/FlowResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/FlowResourceTest.cs new file mode 100644 index 000000000..ddc730d04 --- /dev/null +++ b/test/Twilio.Test/Rest/Studio/V1/FlowResourceTest.cs @@ -0,0 +1,132 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Studio.V1; + +namespace Twilio.Tests.Rest.Studio.V1 +{ + + [TestFixture] + public class FlowTest : TwilioTest + { + [Test] + public void TestReadRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + FlowResource.Read(client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestReadEmptyResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"meta\": {\"previous_page_url\": null,\"next_page_url\": null,\"url\": \"https://studio.twilio.com/v1/Flows?PageSize=50&Page=0\",\"page\": 0,\"first_page_url\": \"https://studio.twilio.com/v1/Flows?PageSize=50&Page=0\",\"page_size\": 50,\"key\": \"flows\"},\"flows\": []}" + )); + + var response = FlowResource.Read(client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + FlowResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"Test Flow\",\"status\": \"published\",\"version\": 1,\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"engagements\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements\"}}" + )); + + var response = FlowResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestDeleteRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Delete, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + FlowResource.Delete("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestDeleteResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.NoContent, + "null" + )); + + var response = FlowResource.Delete("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Video/V1/CompositionResourceTest.cs b/test/Twilio.Test/Rest/Video/V1/CompositionResourceTest.cs new file mode 100644 index 000000000..0b0cc1de9 --- /dev/null +++ b/test/Twilio.Test/Rest/Video/V1/CompositionResourceTest.cs @@ -0,0 +1,183 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Video.V1; + +namespace Twilio.Tests.Rest.Video.V1 +{ + + [TestFixture] + public class CompositionTest : TwilioTest + { + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Video, + "/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + CompositionResource.Fetch("CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_completed\": \"2015-07-30T20:01:33Z\",\"date_deleted\": null,\"sid\": \"CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"audio_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"video_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"video_layout\": \"GRID\",\"resolution\": \"1280x720\",\"format\": \"webm\",\"bitrate\": 64,\"size\": 4,\"duration\": 6,\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" + )); + + var response = CompositionResource.Fetch("CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestReadRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Video, + "/v1/Compositions", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + CompositionResource.Read(client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestReadEmptyResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"compositions\": [],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"compositions\"}}" + )); + + var response = CompositionResource.Read(client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestReadResultsResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"compositions\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_completed\": \"2015-07-30T20:01:33Z\",\"date_deleted\": null,\"sid\": \"CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"audio_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\"],\"video_sources\": [],\"video_layout\": \"GRID\",\"resolution\": \"1280x720\",\"format\": \"mp3\",\"bitrate\": 16,\"size\": 55,\"duration\": 10,\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"compositions\"}}" + )); + + var response = CompositionResource.Read(client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestDeleteRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Delete, + Twilio.Rest.Domain.Video, + "/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + CompositionResource.Delete("CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestDeleteResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.NoContent, + "null" + )); + + var response = CompositionResource.Delete("CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestCreateRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Post, + Twilio.Rest.Domain.Video, + "/v1/Compositions", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + CompositionResource.Create(client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestCreateResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.Created, + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"processing\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_completed\": null,\"date_deleted\": null,\"sid\": \"CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"audio_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\"],\"video_sources\": [],\"video_layout\": \"GRID\",\"resolution\": \"1280x720\",\"format\": \"mp3\",\"bitrate\": 0,\"size\": 0,\"duration\": 1,\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" + )); + + var response = CompositionResource.Create(client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Video/V1/RecordingResourceTest.cs b/test/Twilio.Test/Rest/Video/V1/RecordingResourceTest.cs index 302b6bdf9..5fd627a18 100644 --- a/test/Twilio.Test/Rest/Video/V1/RecordingResourceTest.cs +++ b/test/Twilio.Test/Rest/Video/V1/RecordingResourceTest.cs @@ -49,7 +49,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"processing\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"source_sid\": \"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 0,\"url\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"type\": \"audio\",\"duration\": 0,\"container_format\": \"mka\",\"codec\": \"OPUS\",\"grouping_sids\": {\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"media_external_location\": \"https://my-super-duper-bucket.s3.amazonaws.com/my/path/\",\"encryption_key\": \"public_key\",\"links\": {\"media\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"processing\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"source_sid\": \"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 0,\"url\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"type\": \"audio\",\"duration\": 0,\"container_format\": \"mka\",\"codec\": \"OPUS\",\"track_name\": \"A name\",\"grouping_sids\": {\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"media_external_location\": \"https://my-super-duper-bucket.s3.amazonaws.com/my/path/\",\"encryption_key\": \"public_key\",\"links\": {\"media\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" )); var response = RecordingResource.Fetch("RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -100,7 +100,7 @@ public void TestReadResultsResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"recordings\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"source_sid\": \"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 23,\"type\": \"audio\",\"duration\": 10,\"container_format\": \"mka\",\"codec\": \"OPUS\",\"grouping_sids\": {\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"participant_sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"media_external_location\": \"https://my-super-duper-bucket.s3.amazonaws.com/my/path/\",\"encryption_key\": \"public_key\",\"url\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Recordings?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Recordings?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"recordings\"}}" + "{\"recordings\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"source_sid\": \"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 23,\"type\": \"audio\",\"duration\": 10,\"container_format\": \"mka\",\"codec\": \"OPUS\",\"track_name\": \"A name\",\"grouping_sids\": {\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"participant_sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"media_external_location\": \"https://my-super-duper-bucket.s3.amazonaws.com/my/path/\",\"encryption_key\": \"public_key\",\"url\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Recordings?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Recordings?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"recordings\"}}" )); var response = RecordingResource.Read(client: twilioRestClient); diff --git a/test/Twilio.Test/Rest/Video/V1/Room/Participant/SubscribedTrackResourceTest.cs b/test/Twilio.Test/Rest/Video/V1/Room/Participant/SubscribedTrackResourceTest.cs new file mode 100644 index 000000000..eb57ab18c --- /dev/null +++ b/test/Twilio.Test/Rest/Video/V1/Room/Participant/SubscribedTrackResourceTest.cs @@ -0,0 +1,111 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Video.V1.Room.Participant; + +namespace Twilio.Tests.Rest.Video.V1.Room.Participant +{ + + [TestFixture] + public class SubscribedTrackTest : TwilioTest + { + [Test] + public void TestReadRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Video, + "/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + SubscribedTrackResource.Read("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestReadEmptyResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"subscribed_tracks\": [],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"subscribed_tracks\"}}" + )); + + var response = SubscribedTrackResource.Read("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestReadFiltersResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"subscribed_tracks\": [{\"publisher_sid\": \"PAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"subscriber_sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"sid\": \"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"name\": \"bob-track\",\"kind\": \"data\",\"enabled\": true}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"subscribed_tracks\"}}" + )); + + var response = SubscribedTrackResource.Read("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + + [Test] + public void TestUpdateRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Post, + Twilio.Rest.Domain.Video, + "/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + SubscribedTrackResource.Update("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestUpdateFiltersResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"publisher_sid\": null,\"subscriber_sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": null,\"date_updated\": null,\"sid\": null,\"name\": \"bob-track\",\"kind\": \"data\",\"enabled\": null}" + )); + + var response = SubscribedTrackResource.Update("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Video/V1/Room/ParticipantResourceTest.cs b/test/Twilio.Test/Rest/Video/V1/Room/ParticipantResourceTest.cs index 77e3498f0..235395649 100644 --- a/test/Twilio.Test/Rest/Video/V1/Room/ParticipantResourceTest.cs +++ b/test/Twilio.Test/Rest/Video/V1/Room/ParticipantResourceTest.cs @@ -49,7 +49,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"start_time\": \"2015-07-30T20:00:00Z\",\"end_time\": null,\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"bob\",\"status\": \"connected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": null,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\"}}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"start_time\": \"2015-07-30T20:00:00Z\",\"end_time\": null,\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"bob\",\"status\": \"connected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": null,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\",\"subscribed_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks\"}}" )); var response = ParticipantResource.Fetch("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -100,7 +100,7 @@ public void TestReadFiltersResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"participants\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2017-07-30T20:00:00Z\",\"date_updated\": \"2017-07-30T20:00:00Z\",\"start_time\": \"2017-07-30T20:00:00Z\",\"end_time\": \"2017-07-30T20:00:01Z\",\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"alice\",\"status\": \"disconnected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": 1,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"participants\"}}" + "{\"participants\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2017-07-30T20:00:00Z\",\"date_updated\": \"2017-07-30T20:00:00Z\",\"start_time\": \"2017-07-30T20:00:00Z\",\"end_time\": \"2017-07-30T20:00:01Z\",\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"alice\",\"status\": \"disconnected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": 1,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\",\"subscribed_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"participants\"}}" )); var response = ParticipantResource.Read("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -136,7 +136,7 @@ public void TestUpdateResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2017-07-30T20:00:00Z\",\"date_updated\": \"2017-07-30T20:00:00Z\",\"start_time\": \"2017-07-30T20:00:00Z\",\"end_time\": \"2017-07-30T20:00:01Z\",\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"alice\",\"status\": \"disconnected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": 1,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\"}}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2017-07-30T20:00:00Z\",\"date_updated\": \"2017-07-30T20:00:00Z\",\"start_time\": \"2017-07-30T20:00:00Z\",\"end_time\": \"2017-07-30T20:00:01Z\",\"sid\": \"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"alice\",\"status\": \"disconnected\",\"url\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"duration\": 1,\"links\": {\"published_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PublishedTracks\",\"subscribed_tracks\": \"https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedTracks\"}}" )); var response = ParticipantResource.Update("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient);