public async Task <ParticipantResult> call(ChallongeAPICaller caller)
        {
            int?id = ParticipantIDCache.Instance.GetParticipantID(ParticipantID);

            if (id.HasValue)
            {
                ParticipantQueryResult participantResult = await caller.GET <ParticipantQueryResult>(getAPIPath(id), getParameters());

                if (participantResult?.participant != null)
                {
                    return(participantResult.participant);
                }
            }

            List <ParticipantQueryResult> participantGroupResult = await caller.GET <List <ParticipantQueryResult> >(getAPIPath(null), getParameters());

            ParticipantIDCache.Instance.PopulateCache(participantGroupResult.Select(x => x.participant).ToArray());
            return(participantGroupResult.FirstOrDefault(x => x.participant.id == ParticipantID.ID || x.participant.group_player_ids.Contains(ParticipantID.GroupID))?.participant);
        }
示例#2
0
        public async Task <ParticipantResult> call(ChallongeAPICaller caller)
        {
            ParticipantQueryResult participantResult = await caller.POST <ParticipantQueryResult>(getAPIPath(), getParameters());

            return(participantResult.participant);
        }