Skip to content

Commit c60e8b5

Browse files
authored
Expand satori API with new experiment phase names. (#185)
1 parent 8bf541f commit c60e8b5

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

interface/include/nakama-cpp/satori/HardcodedLowLevelSatoriAPI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ struct SExperiment {
9292
std::string value;
9393
// The labels associated with this experiment.
9494
std::vector<std::string> labels;
95+
// Experiment Phase name
96+
std::string phase_name;
97+
// Experiment Phase Variant name
98+
std::string phase_variant_name;
9599
};
96100

97101
// All experiments that this identity is involved with.

satori-cpp/api/satori.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ message Experiment {
298298
string value = 2;
299299
// The labels associated with this experiment.
300300
repeated string labels = 3;
301+
// Experiment Phase name
302+
string phase_name = 4;
303+
// Experiment Phase Variant name
304+
string phase_variant_name = 5;
301305
}
302306

303307
// All experiments that this identity is involved with.

satori-cpp/src/InternalLowLevelSatoriAPI.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ bool jsonValueToSExperiment(const rapidjson::Value& input, SExperiment& output)
144144
output.labels.emplace_back(jsonLabel.GetString());
145145
}
146146
}
147+
if (input.HasMember("phase_name")) {
148+
if (!input["phase_name"].IsString()) {
149+
return false;
150+
}
151+
output.phase_name = input["phase_name"].GetString();
152+
}
153+
if (input.HasMember("phase_variant_name")) {
154+
if (!input["phase_variant_name"].IsString()) {
155+
return false;
156+
}
157+
output.phase_variant_name = input["phase_variant_name"].GetString();
158+
}
147159
return true;
148160
}
149161

0 commit comments

Comments
 (0)