diff --git a/OptimizelySDK.Net35/OptimizelySDK.Net35.csproj b/OptimizelySDK.Net35/OptimizelySDK.Net35.csproj
index c89f5c86..93b868c7 100644
--- a/OptimizelySDK.Net35/OptimizelySDK.Net35.csproj
+++ b/OptimizelySDK.Net35/OptimizelySDK.Net35.csproj
@@ -115,6 +115,9 @@
Exceptions\OptimizelyException.cs
+
+ IOptimizely.cs
+
Logger\DefaultLogger.cs
diff --git a/OptimizelySDK.Net40/OptimizelySDK.Net40.csproj b/OptimizelySDK.Net40/OptimizelySDK.Net40.csproj
index 20daf229..b8c5cf5c 100644
--- a/OptimizelySDK.Net40/OptimizelySDK.Net40.csproj
+++ b/OptimizelySDK.Net40/OptimizelySDK.Net40.csproj
@@ -116,6 +116,9 @@
Exceptions\OptimizelyException.cs
+
+ IOptimizely.cs
+
Logger\DefaultLogger.cs
diff --git a/OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj b/OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
index 134e5ede..1364493c 100644
--- a/OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
+++ b/OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
@@ -37,6 +37,7 @@
+
diff --git a/OptimizelySDK/IOptimizely.cs b/OptimizelySDK/IOptimizely.cs
new file mode 100644
index 00000000..edd25e8a
--- /dev/null
+++ b/OptimizelySDK/IOptimizely.cs
@@ -0,0 +1,135 @@
+/**
+ * Copyright 2018, Optimizely, Inc. and contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using OptimizelySDK.Entity;
+using System.Collections.Generic;
+
+namespace OptimizelySDK
+{
+ public interface IOptimizely
+ {
+ ///
+ /// Returns true if the IOptimizely instance was initialized with a valid datafile
+ ///
+ bool IsValid { get; }
+
+ ///
+ /// Buckets visitor and sends impression event to Optimizely.
+ ///
+ /// experimentKey string Key identifying the experiment
+ /// string ID for user
+ /// associative array of Attributes for the user
+ /// null|Variation Representing variation
+ Variation Activate(string experimentKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Sends conversion event to Optimizely.
+ ///
+ /// Event key representing the event which needs to be recorded
+ /// ID for user
+ /// Attributes of the user
+ /// eventTags array Hash representing metadata associated with the event.
+ void Track(string eventKey, string userId, UserAttributes userAttributes = null, EventTags eventTags = null);
+
+ ///
+ /// Get variation where user will be bucketed
+ ///
+ /// experimentKey string Key identifying the experiment
+ /// ID for the user
+ /// Attributes for the users
+ /// null|Variation Representing variation
+ Variation GetVariation(string experimentKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Force a user into a variation for a given experiment.
+ ///
+ /// The experiment key
+ /// The user ID
+ /// The variation key specifies the variation which the user will be forced into.
+ /// If null, then clear the existing experiment-to-variation mapping.
+ /// A boolean value that indicates if the set completed successfully.
+ bool SetForcedVariation(string experimentKey, string userId, string variationKey);
+
+ ///
+ /// Gets the forced variation key for the given user and experiment.
+ ///
+ /// The experiment key
+ /// The user ID
+ /// null|string The variation key.
+ Variation GetForcedVariation(string experimentKey, string userId);
+
+ #region FeatureFlag APIs
+
+ ///
+ /// Determine whether a feature is enabled.
+ /// Send an impression event if the user is bucketed into an experiment using the feature.
+ ///
+ /// The feature key
+ /// The user ID
+ /// The user's attributes.
+ /// True if feature is enabled, false or null otherwise
+ bool IsFeatureEnabled(string featureKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Gets boolean feature variable value.
+ ///
+ /// The feature flag key
+ /// The variable key
+ /// The user ID
+ /// The user's attributes
+ /// bool | Feature variable value or null
+ bool? GetFeatureVariableBoolean(string featureKey, string variableKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Gets double feature variable value.
+ ///
+ /// The feature flag key
+ /// The variable key
+ /// The user ID
+ /// The user's attributes
+ /// double | Feature variable value or null
+ double? GetFeatureVariableDouble(string featureKey, string variableKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Gets integer feature variable value.
+ ///
+ /// The feature flag key
+ /// The variable key
+ /// The user ID
+ /// The user's attributes
+ /// int | Feature variable value or null
+ int? GetFeatureVariableInteger(string featureKey, string variableKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Gets string feature variable value.
+ ///
+ /// The feature flag key
+ /// The variable key
+ /// The user ID
+ /// The user's attributes
+ /// string | Feature variable value or null
+ string GetFeatureVariableString(string featureKey, string variableKey, string userId, UserAttributes userAttributes = null);
+
+ ///
+ /// Get the list of features that are enabled for the user.
+ ///
+ /// The user Id
+ /// The user's attributes
+ /// List of the feature keys that are enabled for the user.
+ List GetEnabledFeatures(string userId, UserAttributes userAttributes = null);
+
+ #endregion
+ }
+}
diff --git a/OptimizelySDK/Optimizely.cs b/OptimizelySDK/Optimizely.cs
index 06d59d37..62df0dd3 100644
--- a/OptimizelySDK/Optimizely.cs
+++ b/OptimizelySDK/Optimizely.cs
@@ -27,7 +27,7 @@
namespace OptimizelySDK
{
- public class Optimizely
+ public class Optimizely : IOptimizely
{
private Bucketer Bucketer;
@@ -152,7 +152,7 @@ private bool ValidatePreconditions(Experiment experiment, string userId, UserAtt
///
/// experimentKey string Key identifying the experiment
/// string ID for user
- /// associative array of Attributes for the user
+ /// associative array of Attributes for the user
/// null|Variation Representing variation
public Variation Activate(string experimentKey, string userId, UserAttributes userAttributes = null)
{
@@ -360,7 +360,7 @@ public Variation GetForcedVariation(string experimentKey, string userId)
/// Determine whether a feature is enabled.
/// Send an impression event if the user is bucketed into an experiment using the feature.
///
- /// The experiment key
+ /// The feature key
/// The user ID
/// The user's attributes.
/// True if feature is enabled, false or null otherwise
diff --git a/OptimizelySDK/OptimizelySDK.csproj b/OptimizelySDK/OptimizelySDK.csproj
index b021922d..887d8537 100644
--- a/OptimizelySDK/OptimizelySDK.csproj
+++ b/OptimizelySDK/OptimizelySDK.csproj
@@ -92,6 +92,7 @@
+