public async Task <Dictionary <string, List <KeyValuePair <string, object> > > > GetUdfValueBatch(IEnumerable <string> roleIds, CancellationToken cancellationToken = default)
            {
                var param = new UdfValueBatchParam(UdfTargetType.ROLE, roleIds);
                var res   = await client.Request <UdfValueBatchResponse>(param.CreateRequest(), cancellationToken);

                var dic = new Dictionary <string, List <KeyValuePair <string, object> > >();

                res.Result.ToList().ForEach(
                    item =>
                    dic.Add(item.TargetId, AuthingUtils.ConverUdvToKeyValuePair(item.Data))
                    );
                return(dic);
            }
Exemplo n.º 2
0
            public async Task <Dictionary <string, List <KeyValuePair <string, object> > > > GetUdfValueBatch(string[] userIds, CancellationToken cancellation = default)
            {
                if (userIds.Length < 1)
                {
                    throw new Exception("empty user id list");
                }
                var param = new UdfValueBatchParam(UdfTargetType.USER, userIds);
                var res   = await client.Request <UdfValueBatchResponse>(param.CreateRequest(), cancellation);

                var dic = new Dictionary <string, List <KeyValuePair <string, object> > >();

                foreach (var item in res.Result)
                {
                    dic.Add(item.TargetId, AuthingUtils.ConverUdvToKeyValuePair(item.Data));
                }
                return(dic);
            }