Inheritance: TelAPIBase
Exemplo n.º 1
0
        /// <summary>
        /// Create a new application for managing TelAPI phone numbers
        /// </summary>
        /// <param name="application">Application object</param>
        /// <returns></returns>
        public Application CreateApplication(Application application)
        {
            var request = new RestRequest(Method.POST);
            request.Resource = RequestUri.CreateApplicationUri;

            CreateApplicationParams(application, request);

            return Execute<Application>(request);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new application for managing TelAPI phone numbers
        /// </summary>
        /// <param name="application">Application object</param>
        /// <returns></returns>
        public async Task<Application> CreateApplication(Application application)
        {
            var request = new RestRequest(System.Net.Http.HttpMethod.Post);
            request.Resource = RequestUri.CreateApplicationUri;

            CreateApplicationParams(application, request);

            return await Execute<Application>(request);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update application data
        /// </summary>
        /// <param name="application">Application object</param>
        /// <returns></returns>
        public Application UpdateApplication(Application application)
        {
            Require.Argument("ApplicationSid", application.Sid);

            var request = new RestRequest(Method.POST);
            request.Resource = RequestUri.UpdateApplicationUri;
            request.AddUrlSegment(RequestUriParams.ApplicationSid, application.Sid);

            CreateApplicationParams(application, request);

            return Execute<Application>(request);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Update application data
        /// </summary>
        /// <param name="application">Application object</param>
        /// <returns></returns>
        public async Task<Application> UpdateApplication(Application application)
        {
            Require.Argument("ApplicationSid", application.Sid);

            var request = new RestRequest(System.Net.Http.HttpMethod.Post);
            request.Resource = RequestUri.UpdateApplicationUri;
            request.AddUrlSegment(RequestUriParams.ApplicationSid, application.Sid);

            CreateApplicationParams(application, request);

            return await Execute<Application>(request);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Populate Rest request with application params
        /// </summary>
        /// <param name="application">Application object</param>
        /// <param name="request">Rest request</param>
        private void CreateApplicationParams(Application application, RestRequest request)
        {
            Require.Argument("FriendlyName", application.FriendlyName);
            request.AddParameter("FriendlyName", application.FriendlyName);

            if (application.VoiceUrl.HasValue()) request.AddParameter("VoiceUrl", application.VoiceUrl);
            if (application.VoiceMethod.HasValue()) request.AddParameter("VoiceMethod", application.VoiceMethod);
            if (application.VoiceFallbackUrl.HasValue()) request.AddParameter("VoiceFallbackUrl", application.VoiceFallbackUrl);
            if (application.VoiceFallbackMethod.HasValue()) request.AddParameter("VoiceFallbackMethod", application.VoiceFallbackMethod);
            if (application.VoiceCallerIdLookup.HasValue()) request.AddParameter("VoiceCallerIdLookup", application.VoiceCallerIdLookup);
            if (application.SmsUrl.HasValue()) request.AddParameter("SmsUrl", application.SmsUrl);
            if (application.SmsMethod.HasValue()) request.AddParameter("SmsMethod", application.SmsMethod);
            if (application.SmsFallbackUrl.HasValue()) request.AddParameter("SmsFallbackUrl", application.SmsFallbackUrl);
            if (application.SmsFallbackMethod.HasValue()) request.AddParameter("SmsFallbackMethod", application.SmsFallbackMethod);
            if (application.HeartbeatUrl.HasValue()) request.AddParameter("HeartbeatUrl", application.HeartbeatUrl);
            if (application.HeartbeatMethod.HasValue()) request.AddParameter("HeartbeatMethod", application.HeartbeatMethod);
            if (application.HangupCallback.HasValue()) request.AddParameter("HangupCallback", application.HangupCallback);
            if (application.HangupCallbackMethod.HasValue()) request.AddParameter("HangupCallbackMethod", application.HangupCallbackMethod);
        }