コード例 #1
0
        /// <summary>
        /// Create a new enrollment Access Token for the Entity
        /// </summary>
        /// <param name="options"> Create AccessToken parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of AccessToken </returns>
        public static AccessTokenResource Create(CreateAccessTokenOptions 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 enrollment Access Token for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="identity"> Unique external identifier of the Entity </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of AccessToken </returns>
        public static AccessTokenResource Create(string pathServiceSid,
                                                 string identity,
                                                 AccessTokenResource.FactorTypesEnum factorType,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreateAccessTokenOptions(pathServiceSid, identity, factorType);

            return(Create(options, client));
        }
コード例 #3
0
 private static Request BuildCreateRequest(CreateAccessTokenOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/AccessTokens",
                postParams: options.GetParams()
                ));
 }
コード例 #4
0
        /// <summary>
        /// Create a new enrollment Access Token for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="identity"> Unique external identifier of the Entity </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of AccessToken </returns>
        public static async System.Threading.Tasks.Task <AccessTokenResource> CreateAsync(string pathServiceSid,
                                                                                          string identity,
                                                                                          AccessTokenResource.FactorTypesEnum factorType,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreateAccessTokenOptions(pathServiceSid, identity, factorType);

            return(await CreateAsync(options, client));
        }
コード例 #5
0
        /// <summary>
        /// Create a new enrollment Access Token for the Entity
        /// </summary>
        /// <param name="options"> Create AccessToken parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of AccessToken </returns>
        public static async System.Threading.Tasks.Task <AccessTokenResource> CreateAsync(CreateAccessTokenOptions options,
                                                                                          ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }