Exemplo n.º 1
0
        public async Task <IList <ChatSummaryModel> > GetChannelsAsync()
        {
            var request = new GetChatsListRequest(_chatConfig.ApiUrl);

            var result = await _httpClient.GetModelOrExceptionAsync <IList <ChatSummaryModel>, IList <ChannelSummaryResponse> >(request,
                                                                                                                                _logger, x => x.Select(Mapper.DtoToChatSummary).ToList()).ConfigureAwait(false);

            return(result.Model);
        }
Exemplo n.º 2
0
        public static async Task <TModel> GetModelAsync <TModel, TDto>(
            this IRestHttpClient restHttpClient,
            BaseRestRequest request,
            ILogger logger,
            Func <TDto, TModel> dtoToModelConverter)
        {
            var result = await restHttpClient.GetModelOrExceptionAsync(request, logger, dtoToModelConverter);

            return(result.Model);
        }