Exemplo n.º 1
0
        /// <summary>
        /// Create a new Device in the Fleet, optionally giving it a unique name, friendly name, and assigning to a Deployment
        /// and/or human identity.
        /// </summary>
        /// <param name="options"> Create Device parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Device </returns>
        public static DeviceResource Create(CreateDeviceOptions 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 a new Device in the Fleet, optionally giving it a unique name, friendly name, and assigning to a Deployment
        /// and/or human identity.
        /// </summary>
        ///
        /// <param name="options"> Create Device parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Device </returns>
        public static async System.Threading.Tasks.Task <DeviceResource> CreateAsync(CreateDeviceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new Device in the Fleet, optionally giving it a unique name, friendly name, and assigning to a Deployment
        /// and/or human identity.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="uniqueName"> A unique, addressable name of this Device. </param>
        /// <param name="friendlyName"> A human readable description for this Device. </param>
        /// <param name="identity"> An identifier of the Device user. </param>
        /// <param name="deploymentSid"> The unique SID of the Deployment group. </param>
        /// <param name="enabled"> The enabled </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Device </returns>
        public static async System.Threading.Tasks.Task <DeviceResource> CreateAsync(string pathFleetSid, string uniqueName = null, string friendlyName = null, string identity = null, string deploymentSid = null, bool?enabled = null, ITwilioRestClient client = null)
        {
            var options = new CreateDeviceOptions(pathFleetSid)
            {
                UniqueName = uniqueName, FriendlyName = friendlyName, Identity = identity, DeploymentSid = deploymentSid, Enabled = enabled
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create a new Device in the Fleet, optionally giving it a unique name, friendly name, and assigning to a Deployment
        /// and/or human identity.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="uniqueName"> A unique, addressable name of this Device. </param>
        /// <param name="friendlyName"> A human readable description for this Device. </param>
        /// <param name="identity"> An identifier of the Device user. </param>
        /// <param name="deploymentSid"> The unique SID of the Deployment group. </param>
        /// <param name="enabled"> The enabled </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Device </returns>
        public static DeviceResource Create(string pathFleetSid, string uniqueName = null, string friendlyName = null, string identity = null, string deploymentSid = null, bool?enabled = null, ITwilioRestClient client = null)
        {
            var options = new CreateDeviceOptions(pathFleetSid)
            {
                UniqueName = uniqueName, FriendlyName = friendlyName, Identity = identity, DeploymentSid = deploymentSid, Enabled = enabled
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateDeviceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/DeployedDevices/Fleets/" + options.PathFleetSid + "/Devices",
                postParams: options.GetParams()
                ));
 }