Beispiel #1
0
 public RequestBodyMatchConditionParameters(RequestBodyMatchConditionParametersOdataType odataType, RequestBodyOperator @operator)
 {
     OdataType   = odataType;
     Operator    = @operator;
     MatchValues = new ChangeTrackingList <string>();
     Transforms  = new ChangeTrackingList <TransformCategory>();
 }
 public RequestBodyMatchConditionDefinition(RequestBodyMatchConditionType typeDefinition, RequestBodyOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     MatchValues    = new ChangeTrackingList <string>();
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
 }
Beispiel #3
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("typeName");
     writer.WriteStringValue(ConditionType.ToString());
     writer.WritePropertyName("operator");
     writer.WriteStringValue(RequestBodyOperator.ToString());
     if (Optional.IsDefined(NegateCondition))
     {
         writer.WritePropertyName("negateCondition");
         writer.WriteBooleanValue(NegateCondition.Value);
     }
     if (Optional.IsCollectionDefined(MatchValues))
     {
         writer.WritePropertyName("matchValues");
         writer.WriteStartArray();
         foreach (var item in MatchValues)
         {
             writer.WriteStringValue(item);
         }
         writer.WriteEndArray();
     }
     if (Optional.IsCollectionDefined(Transforms))
     {
         writer.WritePropertyName("transforms");
         writer.WriteStartArray();
         foreach (var item in Transforms)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
Beispiel #4
0
 public RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, RequestBodyOperator requestBodyOperator)
 {
     ConditionType       = conditionType;
     RequestBodyOperator = requestBodyOperator;
     MatchValues         = new ChangeTrackingList <string>();
     Transforms          = new ChangeTrackingList <PreTransformCategory>();
 }
Beispiel #5
0
 internal RequestBodyMatchConditionParameters(RequestBodyMatchConditionParametersOdataType odataType, RequestBodyOperator @operator, bool?negateCondition, IList <string> matchValues, IList <TransformCategory> transforms)
 {
     OdataType       = odataType;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
 internal RequestBodyMatchConditionDefinition(RequestBodyMatchConditionType typeDefinition, RequestBodyOperator @operator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     TypeDefinition  = typeDefinition;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Beispiel #7
0
 internal RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, RequestBodyOperator requestBodyOperator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType       = conditionType;
     RequestBodyOperator = requestBodyOperator;
     NegateCondition     = negateCondition;
     MatchValues         = matchValues;
     Transforms          = transforms;
 }
Beispiel #8
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="RequestBodyOperator" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RequestBodyOperator.CreateFrom(sourceValue);
        internal static RequestBodyMatchConditionParameters DeserializeRequestBodyMatchConditionParameters(JsonElement element)
        {
            RequestBodyMatchConditionParametersTypeName typeName  = default;
            RequestBodyOperator                   @operator       = default;
            Optional <bool>                       negateCondition = default;
            Optional <IList <string> >            matchValues     = default;
            Optional <IList <TransformCategory> > transforms      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new RequestBodyMatchConditionParametersTypeName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new RequestBodyOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negateCondition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    negateCondition = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("matchValues"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    matchValues = array;
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TransformCategory> array = new List <TransformCategory>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new TransformCategory(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
            }
            return(new RequestBodyMatchConditionParameters(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }