示例#1
0
            public async Task <IEnumerable <ResUdv> > SetUdvBatch(UdfTargetType udfTargetType, string targetId, KeyValueDictionary udvList, CancellationToken cancellationToken = default)
            {
                var _udvList = new List <UserDefinedDataInput>();

                udvList.ToList().ForEach(udv => _udvList.Add(new UserDefinedDataInput(udv.Key)
                {
                    Value = udv.Value
                }));
                var param = new SetUdvBatchParam(udfTargetType, targetId)
                {
                    UdvList = _udvList
                };
                var res = await client.Request <SetUdvBatchResponse>(param.CreateRequest(), cancellationToken);

                return(AuthingUtils.ConvertUdv(res.Result));
            }
示例#2
0
            public async Task <IEnumerable <UserDefinedData> > SetUdfValue(string userId, KeyValueDictionary data, CancellationToken cancellation = default)
            {
                if (data.Count() < 1)
                {
                    throw new Exception("empty udf value list");
                }
                var param = new SetUdvBatchParam(UdfTargetType.USER, userId)
                {
                    UdvList = data.ToList().Select(item => new UserDefinedDataInput(item.Key)
                    {
                        Value = item.Value.ConvertJson()
                    }),
                };
                var res = await client.Request <SetUdvBatchResponse>(param.CreateRequest(), cancellation);

                return(res.Result);
            }