/// <summary> /// create /// </summary> /// <param name="options"> Create ConnectionPolicyTarget parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of ConnectionPolicyTarget </returns> public static ConnectionPolicyTargetResource Create(CreateConnectionPolicyTargetOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
private static Request BuildCreateRequest(CreateConnectionPolicyTargetOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Voice, "/v1/ConnectionPolicies/" + options.PathConnectionPolicySid + "/Targets", postParams: options.GetParams() )); }
/// <summary> /// create /// </summary> /// <param name="pathConnectionPolicySid"> The SID of the Connection Policy that owns the Target </param> /// <param name="target"> The SIP address you want Twilio to route your calls to </param> /// <param name="friendlyName"> A string to describe the resource </param> /// <param name="priority"> The relative importance of the target </param> /// <param name="weight"> The value that determines the relative load the Target should receive compared to others with /// the same priority </param> /// <param name="enabled"> Whether the Target is enabled </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of ConnectionPolicyTarget </returns> public static ConnectionPolicyTargetResource Create(string pathConnectionPolicySid, Uri target, string friendlyName = null, int?priority = null, int?weight = null, bool?enabled = null, ITwilioRestClient client = null) { var options = new CreateConnectionPolicyTargetOptions(pathConnectionPolicySid, target) { FriendlyName = friendlyName, Priority = priority, Weight = weight, Enabled = enabled }; return(Create(options, client)); }
/// <summary> /// create /// </summary> /// <param name="pathConnectionPolicySid"> The SID of the Connection Policy that owns the Target </param> /// <param name="target"> The SIP address you want Twilio to route your calls to </param> /// <param name="friendlyName"> A string to describe the resource </param> /// <param name="priority"> The relative importance of the target </param> /// <param name="weight"> The value that determines the relative load the Target should receive compared to others with /// the same priority </param> /// <param name="enabled"> Whether the Target is enabled </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of ConnectionPolicyTarget </returns> public static async System.Threading.Tasks.Task <ConnectionPolicyTargetResource> CreateAsync(string pathConnectionPolicySid, Uri target, string friendlyName = null, int?priority = null, int?weight = null, bool?enabled = null, ITwilioRestClient client = null) { var options = new CreateConnectionPolicyTargetOptions(pathConnectionPolicySid, target) { FriendlyName = friendlyName, Priority = priority, Weight = weight, Enabled = enabled }; return(await CreateAsync(options, client)); }
/// <summary> /// create /// </summary> /// <param name="options"> Create ConnectionPolicyTarget parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of ConnectionPolicyTarget </returns> public static async System.Threading.Tasks.Task <ConnectionPolicyTargetResource> CreateAsync(CreateConnectionPolicyTargetOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }