/// <summary>
        /// Create a new Key credential in the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        /// <param name="options"> Create Key parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Key </returns>
        public static KeyResource Create(CreateKeyOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
示例#2
0
        /// <summary>
        /// Create a new Key credential in the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        ///
        /// <param name="options"> Create Key parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Key </returns>
        public static async System.Threading.Tasks.Task <KeyResource> CreateAsync(CreateKeyOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateKeyOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/DeployedDevices/Fleets/" + options.PathFleetSid + "/Keys",
                postParams: options.GetParams()
                ));
 }
示例#4
0
        /// <summary>
        /// Create a new Key credential in the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="friendlyName"> The human readable description for this Key. </param>
        /// <param name="deviceSid"> The unique identifier of a Key to be authenticated. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Key </returns>
        public static async System.Threading.Tasks.Task <KeyResource> CreateAsync(string pathFleetSid, string friendlyName = null, string deviceSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateKeyOptions(pathFleetSid)
            {
                FriendlyName = friendlyName, DeviceSid = deviceSid
            };

            return(await CreateAsync(options, client));
        }
示例#5
0
        /// <summary>
        /// Create a new Key credential in the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="friendlyName"> The human readable description for this Key. </param>
        /// <param name="deviceSid"> The unique identifier of a Key to be authenticated. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Key </returns>
        public static KeyResource Create(string pathFleetSid, string friendlyName = null, string deviceSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateKeyOptions(pathFleetSid)
            {
                FriendlyName = friendlyName, DeviceSid = deviceSid
            };

            return(Create(options, client));
        }