-
Notifications
You must be signed in to change notification settings - Fork 20
feat(OptimizelyConfig): Add new fields to OptimizelyConfig #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
98dcba5
41e684b
c6ad489
9973794
665c553
3c04342
1c0bf1a
ef6218b
9fc9d54
53fbc69
c8ccfca
b85ae86
22a2039
9ace97f
621e62c
ce2505b
b362593
cb47e3c
8ba7fe5
62ed97f
c685c61
7351048
f1e684f
b5d3383
1e9d40f
6a8dafa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2021, Optimizely | ||
* | ||
* 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; | ||
|
||
namespace OptimizelySDK.OptlyConfig | ||
{ | ||
public class OptimizelyAttribute : IdKeyEntity | ||
{ | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2021, Optimizely | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace OptimizelySDK.OptlyConfig | ||
{ | ||
public class OptimizelyAudience | ||
{ | ||
/// <summary> | ||
/// Audience ID | ||
/// </summary> | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// Audience Name | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Audience Conditions | ||
/// </summary> | ||
public object Conditions { get; set; } | ||
|
||
public OptimizelyAudience(string id, string name, object conditions) | ||
{ | ||
Id = id; | ||
Name = name; | ||
Conditions = conditions; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,14 @@ public class OptimizelyConfig | |
public string SDKKey { get; private set; } | ||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string EnvironmentKey { get; private set; } | ||
public OptimizelyEvent[] Events { get; private set; } | ||
public OptimizelyAudience[] Audiences { get; private set; } | ||
public OptimizelyAttribute[] Attributes { get; private set; } | ||
public IDictionary<string, OptimizelyExperiment> ExperimentsMap { get; private set; } | ||
public IDictionary<string, OptimizelyFeature> FeaturesMap { get; private set; } | ||
|
||
private string _datafile; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have auto formatted code, we won't have to make these kinds of fixes. |
||
public OptimizelyConfig(string revision, IDictionary<string, OptimizelyExperiment> experimentsMap, IDictionary<string, OptimizelyFeature> featuresMap, string datafile = null) | ||
{ | ||
Revision = revision; | ||
|
@@ -39,10 +42,13 @@ public OptimizelyConfig(string revision, IDictionary<string, OptimizelyExperimen | |
_datafile = datafile; | ||
} | ||
|
||
public OptimizelyConfig(string revision, string sdkKey, string environmentKey, IDictionary<string, OptimizelyExperiment> experimentsMap, IDictionary<string, OptimizelyFeature> featuresMap, string datafile = null) | ||
public OptimizelyConfig(string revision, string sdkKey, string environmentKey, OptimizelyAttribute[] attributes, OptimizelyAudience[] audiences, OptimizelyEvent[] events, IDictionary<string, OptimizelyExperiment> experimentsMap, IDictionary<string, OptimizelyFeature> featuresMap, string datafile = null) | ||
{ | ||
Revision = revision; | ||
SDKKey = sdkKey; | ||
Attributes = attributes; | ||
Audiences = audiences; | ||
Events = events; | ||
EnvironmentKey = environmentKey; | ||
ExperimentsMap = experimentsMap; | ||
FeaturesMap = featuresMap; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to have these multiple constructors? This is for creating OptimizelyConfig internally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are publicly exposed classes, that's why we added another constructor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's expected that clients use OptimizelyConfig object, not building it. Consider not exposing constructor to public if can be controlled. |
||
|
Uh oh!
There was an error while loading. Please reload this page.