Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Csajtai <[email protected]>
  • Loading branch information
adams85 and z4kn4fein authored Oct 5, 2023
1 parent 4ed6d34 commit d6f44c9
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 43 deletions.
6 changes: 5 additions & 1 deletion src/ConfigCatClient/Models/Condition.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
namespace ConfigCat.Client;

/// <summary>
/// Base interface for conditions.
/// The user conditions that are combined with the AND logical operator.
/// It can be one of the following:
/// - User condition
/// - Segment condition
/// - Prerequisite flag condition
/// </summary>
public interface ICondition { }

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Models/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace ConfigCat.Client;

/// <summary>
/// ConfigCat config.
/// Details of a Config.
/// </summary>
public interface IConfig
{
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Models/PercentageOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace ConfigCat.Client;

/// <summary>
/// Percentage option.
/// Represents a percentage option.
/// </summary>
public interface IPercentageOption : ISettingValueContainer
{
Expand Down
6 changes: 3 additions & 3 deletions src/ConfigCatClient/Models/PrerequisiteFlagComparator.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace ConfigCat.Client;

/// <summary>
/// Prerequisite flag condition operator.
/// Prerequisite flag comparison operator used during the evaluation process.
/// </summary>
public enum PrerequisiteFlagComparator : byte
{
/// <summary>
/// EQUALS - Is the evaluated value of the specified prerequisite flag equal to the comparison value?
/// EQUALS - It matches when the evaluated value of the specified prerequisite flag is equal to the comparison value.
/// </summary>
Equals = 0,

/// <summary>
/// NOT EQUALS - Is the evaluated value of the specified prerequisite flag not equal to the comparison value?
/// NOT EQUALS - It matches when the evaluated value of the specified prerequisite flag is not equal to the comparison value.
/// </summary>
NotEquals = 1
}
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Models/PrerequisiteFlagCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace ConfigCat.Client;

/// <summary>
/// Prerequisite flag condition.
/// Describes a condition that is based on a prerequisite flag.
/// </summary>
public interface IPrerequisiteFlagCondition : ICondition
{
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Models/Segment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace ConfigCat.Client;

/// <summary>
/// Segment.
/// Describes a Segment.
/// </summary>
public interface ISegment
{
Expand Down
6 changes: 3 additions & 3 deletions src/ConfigCatClient/Models/SegmentComparator.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace ConfigCat.Client;

/// <summary>
/// Segment condition operator.
/// The segment comparison operator used during the evaluation process.
/// </summary>
public enum SegmentComparator : byte
{
/// <summary>
/// IS IN SEGMENT - Does the conditions of the specified segment evaluate to true?
/// IS IN SEGMENT - It matches when the conditions of the specified segment are evaluated to true.
/// </summary>
IsIn,

/// <summary>
/// IS NOT IN SEGMENT - Does the conditions of the specified segment evaluate to false?
/// IS NOT IN SEGMENT - It matches when the conditions of the specified segment are evaluated to false.
/// </summary>
IsNotIn,
}
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Models/SegmentCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace ConfigCat.Client;

/// <summary>
/// Segment condition.
/// Describes a condition that is based on a segment.
/// </summary>
public interface ISegmentCondition : ICondition
{
Expand Down
8 changes: 6 additions & 2 deletions src/ConfigCatClient/Models/TargetingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
namespace ConfigCat.Client;

/// <summary>
/// Targeting rule.
/// Describes a targeting rule.
/// </summary>
public interface ITargetingRule
{
/// <summary>
/// The list of conditions (where there is a logical AND relation between the items).
/// The list of conditions that are combined with the AND logical operator.
/// It can be one of the following:
/// - User condition
/// - Segment condition
/// - Prerequisite flag condition
/// </summary>
IReadOnlyList<ICondition> Conditions { get; }

Expand Down
54 changes: 27 additions & 27 deletions src/ConfigCatClient/Models/UserComparator.cs
Original file line number Diff line number Diff line change
@@ -1,137 +1,137 @@
namespace ConfigCat.Client;

/// <summary>
/// User condition operator.
/// The comparison operator the evaluation process must use when it compares the given user attribute's value with the comparison value.
/// </summary>
public enum UserComparator : byte
{
/// <summary>
/// CONTAINS ANY OF - Does the comparison attribute contain any of the comparison values as a substring?
/// CONTAINS ANY OF - It matches when the comparison attribute contains any comparison values as a substring.
/// </summary>
Contains = 2,

/// <summary>
/// NOT CONTAINS ANY OF - Does the comparison attribute not contain any of the comparison values as a substring?
/// NOT CONTAINS ANY OF - It matches when the comparison attribute does not contain any comparison values as a substring.
/// </summary>
NotContains = 3,

/// <summary>
/// IS ONE OF (semver) - Is the comparison attribute interpreted as a semantic version equal to any of the comparison values?
/// IS ONE OF (semver) - It matches when the comparison attribute interpreted as a semantic version is equal to any of the comparison values.
/// </summary>
SemVerOneOf = 4,

/// <summary>
/// IS NOT ONE OF (semver) - Is the comparison attribute interpreted as a semantic version not equal to any of the comparison values?
/// IS NOT ONE OF (semver) - It matches when the comparison attribute interpreted as a semantic version is not equal to any of the comparison values.
/// </summary>
SemVerNotOneOf = 5,

/// <summary>
/// &lt; (semver) - Is the comparison attribute interpreted as a semantic version less than the comparison value?
/// &lt; (semver) - It matches when the comparison attribute interpreted as a semantic version is less than the comparison value.
/// </summary>
SemVerLessThan = 6,

/// <summary>
/// &lt;= (semver) - Is the comparison attribute interpreted as a semantic version less than or equal to the comparison value?
/// &lt;= (semver) - It matches when the comparison attribute interpreted as a semantic version is less than or equal to the comparison value.
/// </summary>
SemVerLessThanEqual = 7,

/// <summary>
/// &gt; (semver) - Is the comparison attribute interpreted as a semantic version greater than the comparison value?
/// &gt; (semver) - It matches when the comparison attribute interpreted as a semantic version is greater than the comparison value.
/// </summary>
SemVerGreaterThan = 8,

/// <summary>
/// &gt;= (semver) - Is the comparison attribute interpreted as a semantic version greater than or equal to the comparison value?
/// &gt;= (semver) - It matches when the comparison attribute interpreted as a semantic version is greater than or equal to the comparison value.
/// </summary>
SemVerGreaterThanEqual = 9,

/// <summary>
/// = (number) - Is the comparison attribute interpreted as a decimal number equal to the comparison value?
/// = (number) - It matches when the comparison attribute interpreted as a decimal number is equal to the comparison value.
/// </summary>
NumberEqual = 10,

/// <summary>
/// != (number) - Is the comparison attribute interpreted as a decimal number not equal to the comparison value?
/// != (number) - It matches when the comparison attribute interpreted as a decimal number is not equal to the comparison value.
/// </summary>
NumberNotEqual = 11,

/// <summary>
/// &lt; (number) - Is the comparison attribute interpreted as a decimal number less than the comparison value?
/// &lt; (number) - It matches when the comparison attribute interpreted as a decimal number is less than the comparison value.
/// </summary>
NumberLessThan = 12,

/// <summary>
/// &lt;= (number) - Is the comparison attribute interpreted as a decimal number less than or equal to the comparison value?
/// &lt;= (number) - It matches when the comparison attribute interpreted as a decimal number is less than or equal to the comparison value.
/// </summary>
NumberLessThanEqual = 13,

/// <summary>
/// &gt; (number) - Is the comparison attribute interpreted as a decimal number greater than the comparison value?
/// &gt; (number) - It matches when the comparison attribute interpreted as a decimal number is greater than the comparison value.
/// </summary>
NumberGreaterThan = 14,

/// <summary>
/// &gt;= (number) - Is the comparison attribute interpreted as a decimal number greater than or equal to the comparison value?
/// &gt;= (number) - It matches when the comparison attribute interpreted as a decimal number is greater than or equal to the comparison value.
/// </summary>
NumberGreaterThanEqual = 15,

/// <summary>
/// IS ONE OF (hashed) - Is the comparison attribute equal to any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// IS ONE OF (hashed) - It matches when the comparison attribute is equal to any of the comparison values (where the comparison is performed using the SHA256 hashes of the values).
/// </summary>
SensitiveOneOf = 16,

/// <summary>
/// IS NOT ONE OF (hashed) - Is the comparison attribute not equal to any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// IS NOT ONE OF (hashed) - It matches when the comparison attribute is not equal to any of the comparison values (where the comparison is performed using the SHA256 hashes of the values).
/// </summary>
SensitiveNotOneOf = 17,

/// <summary>
/// BEFORE (UTC datetime) - Is the comparison attribute interpreted as the seconds elapsed since <see href="https://en.wikipedia.org/wiki/Unix_time">Unix Epoch</see> less than the comparison value?
/// BEFORE (UTC datetime) - It matches when the comparison attribute interpreted as the seconds elapsed since <see href="https://en.wikipedia.org/wiki/Unix_time">Unix Epoch</see> is less than the comparison value.
/// </summary>
DateTimeBefore = 18,

/// <summary>
/// AFTER (UTC datetime) - Is the comparison attribute interpreted as the seconds elapsed since <see href="https://en.wikipedia.org/wiki/Unix_time">Unix Epoch</see> greater than the comparison value?
/// AFTER (UTC datetime) - It matches when the comparison attribute interpreted as the seconds elapsed since <see href="https://en.wikipedia.org/wiki/Unix_time">Unix Epoch</see> is greater than the comparison value.
/// </summary>
DateTimeAfter = 19,

/// <summary>
/// EQUALS (hashed) - Is the comparison attribute equal to the comparison value (where the comparison is performed using the salted SHA256 hashes of the values)?
/// EQUALS (hashed) - It matches when the comparison attribute is equal to the comparison value (where the comparison is performed using the SHA256 hashes of the values).
/// </summary>
SensitiveTextEquals = 20,

/// <summary>
/// NOT EQUALS (hashed) - Is the comparison attribute not equal to the comparison value (where the comparison is performed using the salted SHA256 hashes of the values)?
/// NOT EQUALS (hashed) - It matches when the comparison attribute is not equal to the comparison value (where the comparison is performed using the SHA256 hashes of the values).
/// </summary>
SensitiveTextNotEquals = 21,

/// <summary>
/// STARTS WITH ANY OF (hashed) - Does the comparison attribute start with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// STARTS WITH ANY OF (hashed) - It matches when the comparison attribute starts with any of the comparison values (where the comparison is performed using the SHA256 hashes of the values).
/// </summary>
SensitiveTextStartsWith = 22,

/// <summary>
/// NOT STARTS WITH ANY OF (hashed) - Does the comparison attribute not start with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// NOT STARTS WITH ANY OF (hashed) - It matches when the comparison attribute does not start with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values).
/// </summary>
SensitiveTextNotStartsWith = 23,

/// <summary>
/// ENDS WITH ANY OF (hashed) - Does the comparison attribute end with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// ENDS WITH ANY OF (hashed) - It matches when the comparison attribute ends with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values).
/// </summary>
SensitiveTextEndsWith = 24,

/// <summary>
/// NOT ENDS WITH ANY OF (hashed) - Does the comparison attribute not end with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// NOT ENDS WITH ANY OF (hashed) - It matches when the comparison attribute does not end with any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values).
/// </summary>
SensitiveTextNotEndsWith = 25,

/// <summary>
/// ARRAY CONTAINS ANY OF (hashed) - Does the comparison attribute interpreted as a comma-separated list contain any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// ARRAY CONTAINS ANY OF (hashed) - It matches when the comparison attribute interpreted as a comma-separated list contains any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values).
/// </summary>
SensitiveArrayContains = 26,

/// <summary>
/// ARRAY NOT CONTAINS ANY OF (hashed) - Does the comparison attribute interpreted as a comma-separated list not contain any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values)?
/// ARRAY NOT CONTAINS ANY OF (hashed) - It matches when the comparison attribute interpreted as a comma-separated list does not contain any of the comparison values (where the comparison is performed using the salted SHA256 hashes of the values).
/// </summary>
SensitiveArrayNotContains = 27,
}
4 changes: 2 additions & 2 deletions src/ConfigCatClient/Models/UserCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace ConfigCat.Client;

/// <summary>
/// User condition.
/// Describes a condition that is based on user attributes.
/// </summary>
public interface IUserCondition : ICondition
{
Expand All @@ -27,7 +27,7 @@ public interface IUserCondition : ICondition
UserComparator Comparator { get; }

/// <summary>
/// The value that the attribute is compared to. Can be a value of the following types: <see cref="string"/> (including a semantic version), <see cref="double"/> or <see langword="IReadOnlyList{T}" />, where T is <see cref="string"/>.
/// The value that the User Object's attribute is compared to. Can be a value of the following types: <see cref="string"/> (including a semantic version), <see cref="double"/> or <see langword="IReadOnlyList{T}" />, where T is <see cref="string"/>.
/// </summary>
object ComparisonValue { get; }
}
Expand Down

0 comments on commit d6f44c9

Please sign in to comment.