Example #1
0
        public async Task <Result <int, Error> > GetVoteCountAsync(int levelId)
        {
            var content = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("levelId", levelId.ToString())
            };

            return(await creyClient_.GetAsync <int, Error>(LevelsDefaults.SERVICE_NAME, $"api/v1/levels/vote/vote", null, new FormUrlEncodedContent(content)));
        }
Example #2
0
        public static async Task <HashSet <string> > GetRolesSetAsync(this CreyRestClient creyClient, int accountId)
        {
            var content = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("accountId", accountId.ToString()),
            };

            return((await creyClient.GetAsync <List <string>, Error>(AuthenticationDefaults.SERVICE_NAME, $"api/v2/accounts/roles", null, new FormUrlEncodedContent(content)))
                   .UnwrapOr(err => throw new CommandErrorException <NoData>(err.Message))
                   .ToHashSet());
        }
        public async Task <List <PrefabInfo> > ListByKindAsync(IEnumerable <PrefabKind> kinds)
        {
            var content = new List <KeyValuePair <string, string> >();

            foreach (var kind in kinds)
            {
                content.Add(new KeyValuePair <string, string>("kinds", ((int)kind).ToString()));
            }

            return((await creyClient_.GetAsync <List <PrefabInfo>, Error>(PrefabsDefaults.SERVICE_NAME, $"v1/prefabs/list/kind", null, new FormUrlEncodedContent(content)))
                   .UnwrapOr(err => throw new CommandErrorException <NoData>(err.Message)));
        }