Exemplo n.º 1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(CreateServiceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 2
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="inboundRequestUrl"> The inbound_request_url </param>
        /// <param name="inboundMethod"> The inbound_method </param>
        /// <param name="fallbackUrl"> The fallback_url </param>
        /// <param name="fallbackMethod"> The fallback_method </param>
        /// <param name="statusCallback"> The status_callback </param>
        /// <param name="stickySender"> The sticky_sender </param>
        /// <param name="mmsConverter"> The mms_converter </param>
        /// <param name="smartEncoding"> The smart_encoding </param>
        /// <param name="scanMessageContent"> The scan_message_content </param>
        /// <param name="fallbackToLongCode"> The fallback_to_long_code </param>
        /// <param name="areaCodeGeomatch"> The area_code_geomatch </param>
        /// <param name="validityPeriod"> The validity_period </param>
        /// <param name="synchronousValidation"> The synchronous_validation </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(string friendlyName, Uri inboundRequestUrl = null, Twilio.Http.HttpMethod inboundMethod = null, Uri fallbackUrl = null, Twilio.Http.HttpMethod fallbackMethod = null, Uri statusCallback = null, bool?stickySender = null, bool?mmsConverter = null, bool?smartEncoding = null, ServiceResource.ScanMessageContentEnum scanMessageContent = null, bool?fallbackToLongCode = null, bool?areaCodeGeomatch = null, int?validityPeriod = null, bool?synchronousValidation = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(friendlyName)
            {
                InboundRequestUrl = inboundRequestUrl, InboundMethod = inboundMethod, FallbackUrl = fallbackUrl, FallbackMethod = fallbackMethod, StatusCallback = statusCallback, StickySender = stickySender, MmsConverter = mmsConverter, SmartEncoding = smartEncoding, ScanMessageContent = scanMessageContent, FallbackToLongCode = fallbackToLongCode, AreaCodeGeomatch = areaCodeGeomatch, ValidityPeriod = validityPeriod, SynchronousValidation = synchronousValidation
            };

            return(await CreateAsync(options, client));
        }
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Messaging,
                "/v1/Services",
                postParams: options.GetParams()
                ));
 }
Exemplo n.º 4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(CreateServiceOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }