public async Task <Address> GetAddressAsync( string zipCode) { var apiClient = await _apiClientService.CreateInstanceAsync(); var result = await apiClient.GetAsync <Address>($"address/{zipCode}"); return(result.Data); }
public async Task <IEnumerable <TableColumn> > GetAllColumnsFromTable( DatabaseRequest request, string tableName) { var apiClient = await _apiClientService.CreateInstanceAsync(); var result = await apiClient.PostAsync <List <TableColumn> >($"database/columns", request); return(result.Data); }
public async Task <BaseResult <IUser> > AuthorizeAsync( LoginUser loginUser) { var result = new BaseResult <IUser>(); try { var instance = await _apiClientService.CreateInstanceAsync(); var login = await instance.PostAsync <AuthenticationResult>( "login", loginUser); if (login.Success && login.Data.Authenticated) { var user = await instance .UseAuthenticationBearer(login.Data.AccessToken) .GetAsync <MyLoggedUser>("user"); user.Data.AccessToken = login.Data.AccessToken; result.Data = user.Data; result.Success = result.Data.IsNotNull(); } } catch (Exception ex) { result.Message = ex.ToString(); result.Success = false; } return(result); }