Beispiel #1
0
        public static RecommendResponse Unmarshall(UnmarshallerContext _ctx)
        {
            RecommendResponse recommendResponse = new RecommendResponse();

            recommendResponse.HttpResponse = _ctx.HttpResponse;
            recommendResponse.Code         = _ctx.StringValue("Recommend.code");
            recommendResponse.Message      = _ctx.StringValue("Recommend.message");
            recommendResponse.RequestId    = _ctx.StringValue("Recommend.requestId");

            List <RecommendResponse.Recommend_ResultItem> recommendResponse_result = new List <RecommendResponse.Recommend_ResultItem>();

            for (int i = 0; i < _ctx.Length("Recommend.Result.Length"); i++)
            {
                RecommendResponse.Recommend_ResultItem resultItem = new RecommendResponse.Recommend_ResultItem();
                resultItem.ItemId    = _ctx.StringValue("Recommend.Result[" + i + "].itemId");
                resultItem.ItemType  = _ctx.StringValue("Recommend.Result[" + i + "].itemType");
                resultItem.MatchInfo = _ctx.StringValue("Recommend.Result[" + i + "].matchInfo");
                resultItem.Position  = _ctx.IntegerValue("Recommend.Result[" + i + "].position");
                resultItem.TraceId   = _ctx.StringValue("Recommend.Result[" + i + "].traceId");
                resultItem.TraceInfo = _ctx.StringValue("Recommend.Result[" + i + "].traceInfo");
                resultItem.Weight    = _ctx.FloatValue("Recommend.Result[" + i + "].weight");

                recommendResponse_result.Add(resultItem);
            }
            recommendResponse.Result = recommendResponse_result;

            return(recommendResponse);
        }
Beispiel #2
0
        public Task <RecommendContent> GetRecommendAsync(RecommendResponse res, RecommendContent prevInfo = null)
        {
            var user_tags = res.UserTagParam;
            var seed      = res.Seed;
            var page      = prevInfo?.RecommendInfo.Page ?? res.Page;

            return(Context.Video.GetRecommendAsync(user_tags, seed, page));
        }
        public async Task <RecommendContent> GetRecommendAsync(RecommendResponse res, RecommendContent prevInfo = null)
        {
            var user_tags = res.UserTagParam;
            var seed      = res.Seed;
            var page      = prevInfo?.RecommendInfo.Page ?? res.Page;

            return(await ContextActionAsync(async context =>
            {
                return await context.Video.GetRecommendAsync(user_tags, seed, page);
            }));
        }
            public override async ValueTask <bool> MoveNextAsync()
            {
                if (entity == null)
                {
                    if (await TryGetResponse("/v1/illust/recommended") is (true, var model))
                    {
                        entity = model;
                        UpdateEnumerator();
                    }
                    else
                    {
                        throw new QueryNotRespondingException();
                    }

                    Enumerable.ReportRequestedPages();
                }
Beispiel #5
0
        public void Write(RecommendResponse response, Stream sw)
        {
            sw.StartObject();
            sw.PropertyNameWithColon("accounts");
            sw.StartArray();
            var accounts = response.Ids;
            var limit    = Math.Min(accounts.Count, response.Limit);

            for (int i = 0; i < limit; i++)
            {
                Write(accounts[i], sw);
                if (i < limit - 1)
                {
                    sw.Comma();
                }
            }
            sw.EndArray();
            sw.EndObject();
        }
Beispiel #6
0
        protected override async Task <int> ResetSourceImpl()
        {
            _RecommendResponse = await LoginUserRecommendProvider.GetRecommendFirstAsync();

            if (_RecommendResponse.FirstData.Status == "ok")
            {
                _EndOfRecommend = _RecommendResponse.FirstData.RecommendInfo.EndOfRecommend;

                AddRecommendTags(
                    _RecommendResponse.FirstData.Items.Select(x => x.AdditionalInfo?.Sherlock.Tag)
                    .Where(x => x != null)
                    );
            }
            else
            {
                _EndOfRecommend = true;
            }
            return(1000);
        }