/// <summary>
        /// Send a Command to a Sim.
        /// </summary>
        /// <param name="options"> Create Command parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Command </returns>
        public static CommandResource Create(CreateCommandOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateCommandOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Supersim,
                "/v1/Commands",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Send a Command to a Sim.
        /// </summary>
        /// <param name="sim"> The sid or unique_name of the SIM to send the Command to </param>
        /// <param name="command"> The message body of the command </param>
        /// <param name="callbackMethod"> The HTTP method we should use to call callback_url </param>
        /// <param name="callbackUrl"> The URL we should call after we have sent the command </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Command </returns>
        public static async System.Threading.Tasks.Task <CommandResource> CreateAsync(string sim,
                                                                                      string command,
                                                                                      Twilio.Http.HttpMethod callbackMethod = null,
                                                                                      Uri callbackUrl          = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateCommandOptions(sim, command)
            {
                CallbackMethod = callbackMethod, CallbackUrl = callbackUrl
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Send a Command to a Sim.
        /// </summary>
        /// <param name="sim"> The sid or unique_name of the SIM to send the Command to </param>
        /// <param name="command"> The message body of the command </param>
        /// <param name="callbackMethod"> The HTTP method we should use to call callback_url </param>
        /// <param name="callbackUrl"> The URL we should call after we have sent the command </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Command </returns>
        public static CommandResource Create(string sim,
                                             string command,
                                             Twilio.Http.HttpMethod callbackMethod = null,
                                             Uri callbackUrl          = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateCommandOptions(sim, command)
            {
                CallbackMethod = callbackMethod, CallbackUrl = callbackUrl
            };

            return(Create(options, client));
        }
        /// <summary>
        /// Send a Command to a Sim.
        /// </summary>
        /// <param name="options"> Create Command parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Command </returns>
        public static async System.Threading.Tasks.Task <CommandResource> CreateAsync(CreateCommandOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }