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

            return(FromJson(response.Content));
        }
예제 #2
0
        /// <summary>
        /// Enroll a new Certificate credential to the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="certificateData"> The public certificate data. </param>
        /// <param name="friendlyName"> The human readable description for this Certificate. </param>
        /// <param name="deviceSid"> The unique identifier of a Device to be authenticated. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Certificate </returns>
        public static async System.Threading.Tasks.Task <CertificateResource> CreateAsync(string pathFleetSid, string certificateData, string friendlyName = null, string deviceSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateCertificateOptions(pathFleetSid, certificateData)
            {
                FriendlyName = friendlyName, DeviceSid = deviceSid
            };

            return(await CreateAsync(options, client));
        }
 private static Request BuildCreateRequest(CreateCertificateOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/DeployedDevices/Fleets/" + options.PathFleetSid + "/Certificates",
                postParams: options.GetParams()
                ));
 }
예제 #4
0
        /// <summary>
        /// Enroll a new Certificate credential to the Fleet, optionally giving it a friendly name and assigning to a Device.
        /// </summary>
        ///
        /// <param name="pathFleetSid"> The fleet_sid </param>
        /// <param name="certificateData"> The public certificate data. </param>
        /// <param name="friendlyName"> The human readable description for this Certificate. </param>
        /// <param name="deviceSid"> The unique identifier of a Device to be authenticated. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Certificate </returns>
        public static CertificateResource Create(string pathFleetSid, string certificateData, string friendlyName = null, string deviceSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateCertificateOptions(pathFleetSid, certificateData)
            {
                FriendlyName = friendlyName, DeviceSid = deviceSid
            };

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

            return(FromJson(response.Content));
        }