public bool Parse(ref string requestString, JsonPropertyAttribute attribute, PropertyInfo property, object propertyValue, object propertyParent) { if (property.PropertyType != typeof(StripeDateFilter)) { return(false); } StripeDateFilter stripeDateFilter = (StripeDateFilter)propertyValue; if (stripeDateFilter.EqualTo.HasValue) { RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName, stripeDateFilter.EqualTo.Value.ConvertDateTimeToEpoch().ToString()); } if (stripeDateFilter.LessThan.HasValue) { RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[lt]", stripeDateFilter.LessThan.Value.ConvertDateTimeToEpoch().ToString()); } if (stripeDateFilter.LessThanOrEqual.HasValue) { RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[lte]", stripeDateFilter.LessThanOrEqual.Value.ConvertDateTimeToEpoch().ToString()); } if (stripeDateFilter.GreaterThan.HasValue) { RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[gt]", stripeDateFilter.GreaterThan.Value.ConvertDateTimeToEpoch().ToString()); } if (stripeDateFilter.GreaterThanOrEqual.HasValue) { RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[gte]", stripeDateFilter.GreaterThanOrEqual.Value.ConvertDateTimeToEpoch().ToString()); } return(true); }
public sample_object() { StringContainingText = "Foo"; StringWithDifferentName = "Foo"; Number = 42; Metadata = new Dictionary<string, string> { { "A", "Value-A" }, { "B", "Value-B" } }; EqualDateFilter = new StripeDateFilter { EqualTo = DateTime.Parse("2000-01-01") }; LessThanDateFilter = new StripeDateFilter { LessThan = DateTime.Parse("2000-01-01") }; ComplexDateFilter = new StripeDateFilter { LessThan = DateTime.Parse("2100-01-01"), GreaterThan = DateTime.Parse("2000-01-01") }; }
public sample_object() { StringContainingText = "Foo"; StringWithDifferentName = "Foo"; Number = 42; Metadata = new Dictionary <string, string> { { "A", "Value-A" }, { "B", "Value-B" } }; EqualDateFilter = new StripeDateFilter { EqualTo = DateTime.Parse("2000-01-01") }; LessThanDateFilter = new StripeDateFilter { LessThan = DateTime.Parse("2000-01-01") }; ComplexDateFilter = new StripeDateFilter { LessThan = DateTime.Parse("2100-01-01"), GreaterThan = DateTime.Parse("2000-01-01") }; }