Example #1
0
        internal static Uri With(this Uri uri, DynamicDictionary query)
        {
            if (query == null)
            {
                return(uri);
            }
            if (uri == null)
            {
                return(null);
            }

            var uriBuilder = new UriBuilder(uri);

            foreach (var name in query.GetMemberNames())
            {
                var value             = query.Get(name);
                var enumerableObjects = value as IEnumerable <object>;
                var enumerableStructs = value.GetType() != typeof(string) ? value as IEnumerable : null;

                if (enumerableObjects == null)
                {
                    if (enumerableStructs == null)
                    {
                        AddQuery(uriBuilder, name, value);
                    }
                    else
                    {
                        AddQuery(uriBuilder, name, enumerableStructs.Cast <object>());
                    }
                }
                else
                {
                    AddQuery(uriBuilder, name, enumerableObjects);
                }
            }

            return(uriBuilder.Uri);
        }
Example #2
0
 public PutRequest(string uriString, TBody body, object headers, DynamicDictionary query)
     : base(uriString, headers, query)
 {
     _body = body;
 }
Example #3
0
 protected RequestBase(string uriString, object headers, DynamicDictionary query)
     : this(uriString, headers, query, new JsonMediaTypeFormatter())
 {
 }
Example #4
0
 public DeleteRequest(string uriString, object headers, DynamicDictionary query)
     : base(uriString, headers, query)
 {
 }
Example #5
0
 public Request WithQuery(dynamic query)
 {
     _query = DynamicDictionary.FromObject(query);
     return(this);
 }
Example #6
0
 public GetRequest(string uriString, object headers, DynamicDictionary query, MediaTypeFormatter formatter)
     : base(uriString, headers, query, formatter)
 {
 }