internal static IFeatureflowClient Create(
            string apiKey,
            IEnumerable <Feature> defaultFeatures,
            FeatureflowConfig featureflowConfig)
        {
            var client = new FeatureflowClient(apiKey, defaultFeatures, featureflowConfig);

            using (var evt = new ManualResetEventSlim(false))
            {
                Task.Run(async() =>
                {
                    try
                    {
                        await client.InitializeAsync(CancellationToken.None).ConfigureAwait(false);
                    }
                    finally
                    {
                        evt.Set();
                    }
                });

                evt.Wait();
            }

            return(client);
        }
Esempio n. 2
0
 /// <summary>
 /// Async Featureflow client creation
 /// </summary>
 /// <param name="apiKey">Featureflow API key</param>
 /// <param name="defaultFeatures">Default features</param>
 /// <param name="featureflowConfig">Featureflow client configuration</param>
 /// <param name="cancellationToken">Cancellation token</param>
 /// <returns>Featureflow client</returns>
 public static Task <IFeatureflowClient> CreateAsync(
     string apiKey,
     IEnumerable <Feature> defaultFeatures,
     FeatureflowConfig featureflowConfig,
     CancellationToken cancellationToken)
 {
     return(FeatureflowClient.CreateAsync(apiKey, defaultFeatures, featureflowConfig, cancellationToken));
 }
        internal static async Task <IFeatureflowClient> CreateAsync(
            string apiKey,
            IEnumerable <Feature> defaultFeatures,
            FeatureflowConfig featureflowConfig,
            CancellationToken cancellationToken)
        {
            var client = new FeatureflowClient(apiKey, defaultFeatures, featureflowConfig);
            await client.InitializeAsync(cancellationToken).ConfigureAwait(false);

            return(client);
        }
Esempio n. 4
0
 /// <summary>
 /// Sync Featureflow client creation
 /// </summary>
 /// <param name="apiKey">Featureflow API key</param>
 /// <param name="defaultFeatures">Default features</param>
 /// <param name="featureflowConfig">Featureflow client configuration</param>
 /// <returns>Featureflow client</returns>
 public static IFeatureflowClient Create(string apiKey, IEnumerable <Feature> defaultFeatures, FeatureflowConfig featureflowConfig)
 {
     return(FeatureflowClient.Create(apiKey, defaultFeatures, featureflowConfig));
 }