Exemplo n.º 1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create NewKey parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of NewKey </returns>
        public static NewKeyResource Create(CreateNewKeyOptions 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
        /// </summary>
        ///
        /// <param name="options"> Create NewKey parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of NewKey </returns>
        public static async System.Threading.Tasks.Task <NewKeyResource> CreateAsync(CreateNewKeyOptions 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
        /// </summary>
        ///
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of NewKey </returns>
        public static async System.Threading.Tasks.Task <NewKeyResource> CreateAsync(string pathAccountSid = null, string friendlyName = null, ITwilioRestClient client = null)
        {
            var options = new CreateNewKeyOptions {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of NewKey </returns>
        public static NewKeyResource Create(string pathAccountSid = null, string friendlyName = null, ITwilioRestClient client = null)
        {
            var options = new CreateNewKeyOptions {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName
            };

            return(Create(options, client));
        }
Exemplo n.º 5
0
 private static Request BuildCreateRequest(CreateNewKeyOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Keys.json",
                postParams: options.GetParams()
                ));
 }