public List<EDBasecamp> GetAll(string scope) { List<EDBasecamp> listObjects = new List<EDBasecamp>(); string query = ApiNamespace + "/basecamps"; if (!String.IsNullOrEmpty(scope)) query = query + "?" + scope; var response = RequestGet(query); var json = response.Body; JArray jArray = null; JObject jObject = null; if (json != null && json.Length > 5) jObject = (JObject)JObject.Parse(json); if (jObject == null) return listObjects; jArray = (JArray)jObject["data"]; foreach (JObject jo in jArray) { EDBasecamp obj = new EDBasecamp(); if (obj.ParseJson((JObject)jo)) listObjects.Add(obj); } return listObjects; }
public EDBasecamp GetForId(int id) { if (id > 0) { var request = RequestGet($"{ApiNamespace}/basecamps/{id}"); if (request.StatusCode == HttpStatusCode.OK) { var jo = JObject.Parse(request.Body); var data = jo["data"]; EDBasecamp obj = new EDBasecamp(); return (obj.ParseJson((JObject)data)) ? obj : null; } } return null; }
public EDBasecamp GetForId(int id) { if (id > 0) { var request = RequestGet($"{ApiNamespace}/basecamps/{id}"); if (request.StatusCode == HttpStatusCode.OK) { var jo = JObject.Parse(request.Body); var data = jo["data"]; EDBasecamp obj = new EDBasecamp(); return((obj.ParseJson((JObject)data)) ? obj : null); } } return(null); }
public List <EDBasecamp> GetAll(string scope) { List <EDBasecamp> listObjects = new List <EDBasecamp>(); string query = ApiNamespace + "/basecamps"; if (!String.IsNullOrEmpty(scope)) { query = query + "?" + scope; } var response = RequestGet(query); var json = response.Body; JArray jArray = null; JObject jObject = null; if (json != null && json.Length > 5) { jObject = (JObject)JObject.Parse(json); } if (jObject == null) { return(listObjects); } jArray = (JArray)jObject["data"]; foreach (JObject jo in jArray) { EDBasecamp obj = new EDBasecamp(); if (obj.ParseJson((JObject)jo)) { listObjects.Add(obj); } } return(listObjects); }