/// <summary>
        /// Registers a new Device and Push Token against Trusted Comms API. This works specially for iOS devices, which don't
        /// allow the SDK to know when there's an incoming call, nor the originating number.
        /// </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));
        }
        /// <summary>
        /// Registers a new Device and Push Token against Trusted Comms API. This works specially for iOS devices, which don't
        /// allow the SDK to know when there's an incoming call, nor the originating number.
        /// </summary>
        /// <param name="phoneNumber"> The end user Phone Number </param>
        /// <param name="pushToken"> The Push Token for this Phone Number </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 phoneNumber,
                                                                                     string pushToken,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateDeviceOptions(phoneNumber, pushToken);

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Registers a new Device and Push Token against Trusted Comms API. This works specially for iOS devices, which don't
        /// allow the SDK to know when there's an incoming call, nor the originating number.
        /// </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));
        }
 private static Request BuildCreateRequest(CreateDeviceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/TrustedComms/Devices",
                client.Region,
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Registers a new Device and Push Token against Trusted Comms API. This works specially for iOS devices, which don't
        /// allow the SDK to know when there's an incoming call, nor the originating number.
        /// </summary>
        /// <param name="phoneNumber"> The end user Phone Number </param>
        /// <param name="pushToken"> The Push Token for this Phone Number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Device </returns>
        public static DeviceResource Create(string phoneNumber, string pushToken, ITwilioRestClient client = null)
        {
            var options = new CreateDeviceOptions(phoneNumber, pushToken);

            return(Create(options, client));
        }