-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Add datafile accessor #240
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 all commits
3a299f8
3c78dcd
9a83ba5
9e4ad54
ef5a6bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2019, Optimizely | ||
* Copyright 2019-2020, Optimizely | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -29,6 +29,8 @@ namespace OptimizelySDK.Config | |
/// </summary> | ||
public class DatafileProjectConfig : ProjectConfig | ||
{ | ||
private string _datafile; | ||
|
||
/// <summary> | ||
/// Datafile versions. | ||
/// </summary> | ||
|
@@ -77,6 +79,11 @@ public enum OPTLYSDKVersion | |
/// </summary> | ||
public bool? BotFiltering { get; set; } | ||
|
||
/// <summary> | ||
/// Raw datafile | ||
/// </summary> | ||
public string Datafile { get; set; } | ||
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. use 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. abstract properties can not have private accessors. |
||
|
||
/// <summary> | ||
/// Supported datafile versions list. | ||
/// </summary> | ||
|
@@ -337,6 +344,7 @@ private static DatafileProjectConfig GetConfig(string configData) | |
throw new ConfigParseException("Unable to parse empty datafile."); | ||
|
||
var config = JsonConvert.DeserializeObject<DatafileProjectConfig>(configData); | ||
config._datafile = configData; | ||
|
||
if (SupportedVersions.TrueForAll((supportedVersion) => !(((int)supportedVersion).ToString() == config.Version))) | ||
throw new ConfigParseException($@"This version of the C# SDK does not support the given datafile version: {config.Version}"); | ||
|
@@ -558,5 +566,14 @@ public bool IsFeatureExperiment(string experimentId) | |
{ | ||
return ExperimentFeatureMap.ContainsKey(experimentId); | ||
} | ||
|
||
/// <summary> | ||
///Returns the datafile corresponding to ProjectConfig | ||
/// </summary> | ||
/// <returns>the datafile string corresponding to ProjectConfig</returns> | ||
public string ToDatafile() | ||
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. This isn't used. Any reason to keep it? |
||
{ | ||
return _datafile; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header update? 2020