Exemplo n.º 1
0
        internal static Task <T> AccessParameterReservedApiAsync <T>(this TokensBase t, MethodType m, string uri, string reserved, IEnumerable <KeyValuePair <string, object> > parameters, CancellationToken cancellationToken)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }
            var list = parameters.ToList();
            var kvp  = GetReservedParameter(list, reserved);

            list.Remove(kvp);
            return(t.AccessApiAsyncImpl <T>(m, uri.Replace(string.Format("{{{0}}}", reserved), kvp.Value.ToString()), list, cancellationToken, ""));
        }
Exemplo n.º 2
0
        internal static Task <T> AccessParameterReservedApiAsync <T>(this TokensBase t, MethodType m, string uri, IEnumerable <string> reserveds, IEnumerable <KeyValuePair <string, object> > parameters, CancellationToken cancellationToken)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            var list     = parameters.ToList();
            var replaced = reserveds.Select(reserved =>
            {
                var kvp = GetReservedParameter(list, reserved);
                list.Remove(kvp);
                return(kvp);
            }).Aggregate(uri, (acc, kvp) => acc.Replace(string.Format("{{{0}}}", kvp.Key), kvp.Value.ToString()));

            return(t.AccessApiAsyncImpl <T>(m, replaced, list, cancellationToken, ""));
        }