public async Task <Response> GetReferences(string objectID, string dcaType) { DCATypeModel dcaModel = _dCATypeRepository.GetDCAType(dcaType); if (dcaModel == null) { throw new Exception(string.Format("DCA type mapping is not found for type:{0}", dcaType)); } string path = String.Format(infoObjectsPath + "/references", objectID, dcaModel.AbilityModel); var result = await client.GetAsync(path); result = result.ParseReferenceResult(result, _dCATypeRepository); return(result); }
public async Task <Response> FilterName(string name, string dcaType) { DCATypeModel dcaModel = _dCATypeRepository.GetDCAType(dcaType); var model = dcaModel.AbilityModel; var query = "models('" + model + "').hasName('" + name + "')"; Dictionary <string, string> keyValuePairs = new Dictionary <string, string>(); keyValuePairs.Add("query", query); var result = await client.PostAsync(dslQueryPath, keyValuePairs); if (result.IsSuccess) { result = result.ParseQueryResult(result, _dCATypeRepository); } return(result); }
public async Task <Response> SendQuery(string query) { int dcaTypeStartIndex = query.IndexOf("dcaType"); if (dcaTypeStartIndex == -1) { throw new Exception("Invalid query syntax"); } dcaTypeStartIndex += 9; int dcaTypeIndex = query.IndexOf(")"); var dcaType = query.Substring(dcaTypeStartIndex, dcaTypeIndex - dcaTypeStartIndex - 1); var dcaTypeRepository = _dCATypeRepository.GetDCAType(dcaType); var newQuery = "models('" + dcaTypeRepository.AbilityModel + "')" + query.Substring(dcaTypeIndex + 1); queryModel.query = newQuery; var result = await client.PostAsync(queryPath, queryModel); if (result.IsSuccess) { result = result.ParseQueryResult(result, _dCATypeRepository); } return(result); }
public DCATypeModel GetDCAType(string dcaType) { return(_dcaTypeRepository.GetDCAType(dcaType)); }