< Summary

Class:DCL.Quests.QuestRewardsResolver
Assembly:Quests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Quests/QuestRewardsResolver.cs
Covered lines:0
Uncovered lines:6
Coverable lines:6
Total lines:34
Line coverage:0% (0 of 6)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:1
Method coverage:0% (0 of 1)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ResolveRewards()0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Quests/QuestRewardsResolver.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using DCL;
 3using DCL.Helpers;
 4using DCLServices.QuestsService;
 5using System;
 6using System.Collections;
 7using System.Collections.Generic;
 8using System.Threading;
 9using UnityEngine;
 10using UnityEngine.Networking;
 11
 12namespace DCL.Quests
 13{
 14    public class QuestRewardsResolver : IQuestRewardsResolver
 15    {
 16        private const string QUESTS_API_URL = "https://quests.decentraland.zone/quests";
 17
 18        private readonly Service<IWebRequestController> webRequestController;
 19
 20        public async UniTask<IReadOnlyList<QuestReward>> ResolveRewards(string questId, CancellationToken cancellationTo
 21        {
 22            try
 23            {
 024                UnityWebRequest result = await webRequestController.Ref.GetAsync($"{QUESTS_API_URL}/{questId}/rewards", 
 025                QuestRewardResponse placesAPIResponse = Utils.SafeFromJson<QuestRewardResponse>(result.downloadHandler.t
 026                return new List<QuestReward>(placesAPIResponse.items);
 27            }
 028            catch (Exception e)
 29            {
 030                return new List<QuestReward>() {};
 31            }
 032        }
 33    }
 34}

Methods/Properties

ResolveRewards()