Exemple #1
0
        protected virtual IDictionary <string, string> GetParameters(RequestParameterTypeEnum type)
        {
            var parameterProperties = this.GetPropertiesWhere(prop =>
                                                              prop.GetCustomAttribute <ParameterType>()?.Type == type);

            var dictionary = new Dictionary <string, string>();

            foreach (var parameterProperty in parameterProperties)
            {
                var format = parameterProperty.GetCustomAttribute <Format>();
                var name   = parameterProperty.GetCustomAttribute <Name>().Value;
                var value  = ToString(
                    parameterProperty.GetValue(this),
                    format?.Formatter);

                if (value != null)
                {
                    dictionary.Add(name, value);
                }
            }

            return(new ReadOnlyDictionary <string, string>(dictionary));
        }
Exemple #2
0
        protected override IDictionary <string, string> GetParameters(RequestParameterTypeEnum type)
        {
            if (Before != null)
            {
                if (Q == null)
                {
                    Q = string.Empty;
                }

                Q += $"before:{Before.Value.ToUnixTimeSeconds()} ";
            }

            if (After != null)
            {
                if (Q == null)
                {
                    Q = string.Empty;
                }

                Q += $"after:{After.Value.ToUnixTimeSeconds()} ";
            }

            return(base.GetParameters(type));
        }
Exemple #3
0
 public ParameterType(RequestParameterTypeEnum type)
 {
     Type = type;
 }