/// <summary> /// Create a new Service for Twilio Proxy /// </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)); }
/// <summary> /// Create a new Service for Twilio Proxy /// </summary> /// /// <param name="friendlyName"> A human readable description of this resource. </param> /// <param name="defaultTtl"> Default TTL for a Session, in seconds. </param> /// <param name="callbackUrl"> URL Twilio will send callbacks to </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 = null, int?defaultTtl = null, Uri callbackUrl = null, ITwilioRestClient client = null) { var options = new CreateServiceOptions { FriendlyName = friendlyName, DefaultTtl = defaultTtl, CallbackUrl = callbackUrl }; return(await CreateAsync(options, client)); }
/// <summary> /// Create a new Service for Twilio Proxy /// </summary> /// /// <param name="friendlyName"> A human readable description of this resource. </param> /// <param name="defaultTtl"> Default TTL for a Session, in seconds. </param> /// <param name="callbackUrl"> URL Twilio will send callbacks to </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Service </returns> public static ServiceResource Create(string friendlyName = null, int?defaultTtl = null, Uri callbackUrl = null, ITwilioRestClient client = null) { var options = new CreateServiceOptions { FriendlyName = friendlyName, DefaultTtl = defaultTtl, CallbackUrl = callbackUrl }; return(Create(options, client)); }
private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Proxy, "/v1/Services", postParams: options.GetParams() )); }
/// <summary> /// Create a new Service for Twilio Proxy /// </summary> /// <param name="friendlyName"> A human readable description of this resource. </param> /// <param name="defaultTtl"> Default TTL for a Session, in seconds. </param> /// <param name="callbackUrl"> URL Twilio will send callbacks to </param> /// <param name="geoMatchLevel"> Whether to find proxy numbers in the same areacode. </param> /// <param name="numberSelectionBehavior"> What behavior to use when choosing a proxy number. </param> /// <param name="interceptCallbackUrl"> A URL for Twilio call before each Interaction. </param> /// <param name="outOfSessionCallbackUrl"> A URL for Twilio call when a new Interaction has no Session. </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 = null, int?defaultTtl = null, Uri callbackUrl = null, ServiceResource.GeoMatchLevelEnum geoMatchLevel = null, ServiceResource.NumberSelectionBehaviorEnum numberSelectionBehavior = null, Uri interceptCallbackUrl = null, Uri outOfSessionCallbackUrl = null, ITwilioRestClient client = null) { var options = new CreateServiceOptions() { FriendlyName = friendlyName, DefaultTtl = defaultTtl, CallbackUrl = callbackUrl, GeoMatchLevel = geoMatchLevel, NumberSelectionBehavior = numberSelectionBehavior, InterceptCallbackUrl = interceptCallbackUrl, OutOfSessionCallbackUrl = outOfSessionCallbackUrl }; return(await CreateAsync(options, client)); }
/// <summary> /// Create a new Service for Twilio Proxy /// </summary> /// <param name="uniqueName"> The human-readable string that uniquely identifies this Service. </param> /// <param name="defaultTtl"> Default TTL for Sessions in Service, in seconds. </param> /// <param name="callbackUrl"> URL Twilio will send callbacks to </param> /// <param name="geoMatchLevel"> Whether proxy number selected must be in the same area code as the participant /// identifier. </param> /// <param name="numberSelectionBehavior"> What behavior to use when choosing a proxy number. </param> /// <param name="interceptCallbackUrl"> A URL for Twilio call before each Interaction. </param> /// <param name="outOfSessionCallbackUrl"> A URL for Twilio call when a new Interaction has no Session. </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Service </returns> public static ServiceResource Create(string uniqueName, int?defaultTtl = null, Uri callbackUrl = null, ServiceResource.GeoMatchLevelEnum geoMatchLevel = null, ServiceResource.NumberSelectionBehaviorEnum numberSelectionBehavior = null, Uri interceptCallbackUrl = null, Uri outOfSessionCallbackUrl = null, ITwilioRestClient client = null) { var options = new CreateServiceOptions(uniqueName) { DefaultTtl = defaultTtl, CallbackUrl = callbackUrl, GeoMatchLevel = geoMatchLevel, NumberSelectionBehavior = numberSelectionBehavior, InterceptCallbackUrl = interceptCallbackUrl, OutOfSessionCallbackUrl = outOfSessionCallbackUrl }; return(Create(options, client)); }
/// <summary> /// Create a new Service for Twilio Proxy /// </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)); }