public virtual OdataQueryBuilder GetQueryBuilder() { var builder = new OdataQueryBuilder(ApiUrl); builder.Count = true; return(builder); }
public virtual async Task <APIResponse <TEntity> > GetEntitiesAsync(OdataQueryBuilder odataQueryBuilder = null) { var url = odataQueryBuilder?.BuildUrl() ?? ApiUrl; using var client = new HttpClient(); var response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { var jsonString = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <APIResponse <TEntity> >(jsonString)); } return(new APIResponse <TEntity>()); }
public async Task <List <string> > GetClassificationsAsync() { var odataQueryBuilder = new OdataQueryBuilder(ApiUrl); odataQueryBuilder.Select.Add(nameof(Transaction.Classification)); var response = await base.GetEntitiesAsync(); var classifications = new List <string>() { "" }; foreach (var category in response.Entities.Select(x => x.Classification)) { if (!classifications.Contains(category)) { classifications.Add(category); } } return(classifications); }
public override Task <APIResponse <Transaction> > GetEntitiesAsync(OdataQueryBuilder odataQueryBuilder = null) { return(base.GetEntitiesAsync(odataQueryBuilder)); }
public override Task <APIResponse <Account> > GetEntitiesAsync(OdataQueryBuilder odataQueryBuilder = null) { var builder = GetQueryBuilder(); return(base.GetEntitiesAsync(builder)); }
protected override IEnumerable <KeyValuePair <string, string> > GetQuery() { var queryBuilder = new OdataQueryBuilder <TModel, TResult>(); return(queryBuilder.Build(QueryOptions)); }