Exemple #1
0
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="options"> Create Factor parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Factor </returns>
        public static FactorResource Create(CreateFactorOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #2
0
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="options"> Create Factor parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Factor </returns>
        public static async System.Threading.Tasks.Task <FactorResource> CreateAsync(CreateFactorOptions options,
                                                                                     ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #3
0
 private static Request BuildCreateRequest(CreateFactorOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors",
                postParams: options.GetParams()
                ));
 }
Exemple #4
0
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique external identifier of the Entity </param>
        /// <param name="binding"> A unique binding for this Factor as a json string </param>
        /// <param name="friendlyName"> The friendly name of this Factor </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="config"> The config for this Factor as a json string </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Factor </returns>
        public static async System.Threading.Tasks.Task <FactorResource> CreateAsync(string pathServiceSid,
                                                                                     string pathIdentity,
                                                                                     string binding,
                                                                                     string friendlyName,
                                                                                     FactorResource.FactorTypesEnum factorType,
                                                                                     string config,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config);

            return(await CreateAsync(options, client));
        }
Exemple #5
0
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique external identifier of the Entity </param>
        /// <param name="binding"> A unique binding for this Factor as a json string </param>
        /// <param name="friendlyName"> The friendly name of this Factor </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="config"> The config for this Factor as a json string </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Factor </returns>
        public static FactorResource Create(string pathServiceSid,
                                            string pathIdentity,
                                            string binding,
                                            string friendlyName,
                                            FactorResource.FactorTypesEnum factorType,
                                            string config,
                                            ITwilioRestClient client = null)
        {
            var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config);

            return(Create(options, client));
        }
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique external identifier of the Entity </param>
        /// <param name="binding"> A unique binding for this Factor as a json string </param>
        /// <param name="friendlyName"> The friendly name of this Factor </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="config"> The config for this Factor as a json string </param>
        /// <param name="twilioSandboxMode"> The Twilio-Sandbox-Mode HTTP request header </param>
        /// <param name="authorization"> The Authorization HTTP request header </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Factor </returns>
        public static FactorResource Create(string pathServiceSid,
                                            string pathIdentity,
                                            string binding,
                                            string friendlyName,
                                            FactorResource.FactorTypesEnum factorType,
                                            string config,
                                            string twilioSandboxMode = null,
                                            string authorization     = null,
                                            ITwilioRestClient client = null)
        {
            var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config)
            {
                TwilioSandboxMode = twilioSandboxMode, Authorization = authorization
            };

            return(Create(options, client));
        }
Exemple #7
0
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique external identifier of the Entity </param>
        /// <param name="friendlyName"> The friendly name of this Factor </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="bindingAlg"> The algorithm used when `factor_type` is `push` </param>
        /// <param name="bindingPublicKey"> The public key encoded in Base64 </param>
        /// <param name="configAppId"> The ID that uniquely identifies your app in the Google or Apple store </param>
        /// <param name="configNotificationPlatform"> The transport technology used to generate the Notification Token </param>
        /// <param name="configNotificationToken"> For APN, the device token. For FCM the registration token </param>
        /// <param name="configSdkVersion"> The Verify Push SDK version used to configure the factor </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Factor </returns>
        public static async System.Threading.Tasks.Task <FactorResource> CreateAsync(string pathServiceSid,
                                                                                     string pathIdentity,
                                                                                     string friendlyName,
                                                                                     FactorResource.FactorTypesEnum factorType,
                                                                                     string bindingAlg       = null,
                                                                                     string bindingPublicKey = null,
                                                                                     string configAppId      = null,
                                                                                     FactorResource.NotificationPlatformsEnum configNotificationPlatform = null,
                                                                                     string configNotificationToken = null,
                                                                                     string configSdkVersion        = null,
                                                                                     ITwilioRestClient client       = null)
        {
            var options = new CreateFactorOptions(pathServiceSid, pathIdentity, friendlyName, factorType)
            {
                BindingAlg = bindingAlg, BindingPublicKey = bindingPublicKey, ConfigAppId = configAppId, ConfigNotificationPlatform = configNotificationPlatform, ConfigNotificationToken = configNotificationToken, ConfigSdkVersion = configSdkVersion
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Create a new Factor for the Entity
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique external identifier of the Entity </param>
        /// <param name="friendlyName"> The friendly name of this Factor </param>
        /// <param name="factorType"> The Type of this Factor </param>
        /// <param name="bindingAlg"> The algorithm used when `factor_type` is `push` </param>
        /// <param name="bindingPublicKey"> The public key encoded in Base64 </param>
        /// <param name="configAppId"> The ID that uniquely identifies your app in the Google or Apple store </param>
        /// <param name="configNotificationPlatform"> The transport technology used to generate the Notification Token </param>
        /// <param name="configNotificationToken"> For APN, the device token. For FCM the registration token </param>
        /// <param name="configSdkVersion"> The Verify Push SDK version used to configure the factor </param>
        /// <param name="twilioSandboxMode"> The Twilio-Sandbox-Mode HTTP request header </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Factor </returns>
        public static FactorResource Create(string pathServiceSid,
                                            string pathIdentity,
                                            string friendlyName,
                                            FactorResource.FactorTypesEnum factorType,
                                            string bindingAlg       = null,
                                            string bindingPublicKey = null,
                                            string configAppId      = null,
                                            FactorResource.NotificationPlatformsEnum configNotificationPlatform = null,
                                            string configNotificationToken = null,
                                            string configSdkVersion        = null,
                                            string twilioSandboxMode       = null,
                                            ITwilioRestClient client       = null)
        {
            var options = new CreateFactorOptions(pathServiceSid, pathIdentity, friendlyName, factorType)
            {
                BindingAlg = bindingAlg, BindingPublicKey = bindingPublicKey, ConfigAppId = configAppId, ConfigNotificationPlatform = configNotificationPlatform, ConfigNotificationToken = configNotificationToken, ConfigSdkVersion = configSdkVersion, TwilioSandboxMode = twilioSandboxMode
            };

            return(Create(options, client));
        }