public override Task <AppSettingsResponse> GetAppSettings(Empty request, ServerCallContext context) { var resp = new AppSettingsResponse() { Result = new AppSettingsResponse.Types.AppSettingsData() { BaseAsset = new AppSettingsResponse.Types.ApiAsset() { Id = "usd", Symbol = "USD", Name = "USD", Accuracy = 4, SwiftDepositEnabled = false, CategoryId = "currency", BankCardsDepositEnabled = false, BlockchainDepositEnabled = false, HideDeposit = true, HideWithdraw = true, KycNeeded = true, OtherDepositOptionsEnabled = false }, DebugMode = false, DepositUrl = "deposit-url", } }; //todo: remove not usable app settings return(Task.FromResult(resp)); }
public AppSettingsResponse MapAppSettings(AppSettings appSettings) { var result = new AppSettingsResponse() { AppSettingVals = new AppSettingsVals() { ApplicationTitle = appSettings.ApplicationTitle, Dict = new Dictionary <string, DictionaryVals>(), EnumSwitchVal = (EnumSwitch)Convert.ToInt32(appSettings.AnEnumSwitch), IntSetting = appSettings.IntSetting, StringSetting = appSettings.StringSetting } }; // Mapping a list var stringList = new List <string>(); foreach (var stringVal in appSettings.ListOfValues) { stringList.Add(stringVal); } result.AppSettingVals.ListOfValues = stringList.AsEnumerable(); // Mapping a dictionary - which is a generic collection foreach (var dictEntry in appSettings.DictionarySettings) { var innerClassVal = new DictionaryVals() { IsEnabled = dictEntry.Value.IsEnabled, Name = dictEntry.Value.Name }; result.AppSettingVals.Dict.Add(dictEntry.Key, innerClassVal); } return(result); }
public override async Task <AppSettingsResponse> GetAppSettings(Empty request, ServerCallContext context) { var result = new AppSettingsResponse(); var token = context.GetBearerToken(); var response = await _walletApiV1Client.GetAppSettingsAsync(token); if (response.Result != null) { result.Body = _mapper.Map <AppSettingsResponse.Types.Body>(response.Result); result.Body.FeeSettings.CashOut.AddRange( _mapper.Map <CashOutFee[]>(response.Result.FeeSettings.CashOut?.ToArray() ?? Array.Empty <Lykke.ApiClients.V1.CashOutFee>())); } if (response.Error != null) { result.Error = response.Error.ToApiError(); } return(result); }