public static async Task <AllTimeStats> GetCurrentUserAllTimeStats() { string token = Preferences.Get("token", ""); if (!IsTokenValid(token)) { return(null); } const string sPath = "/api/v1/users/current/all_time_since_today"; string data = await WakaTimeRepo.Get(sPath); if (data == null) { return(null); } JObject obj = JsonConvert.DeserializeObject <JObject>(data); if (obj["data"] == null) { return(null); } return(obj["data"].ToObject <AllTimeStats>()); }
public static async Task <Leaders> GetLeaders(uint page = 1) { const string sPath = "/api/v1/leaders"; string data = await WakaTimeRepo.Get(sPath + "?page=" + page); if (data == null) { return(null); } return(JsonConvert.DeserializeObject <Leaders>(data)); }
public static async Task <Stats> GetUserStats(string guid) { string sPath = $"/api/v1/users/{guid}/stats/last_7_days"; string data = await WakaTimeRepo.Get(sPath); if (data == null) { return(null); } JObject obj = JsonConvert.DeserializeObject <JObject>(data); if (obj["data"] == null) { return(null); } return(obj["data"].ToObject <Stats>()); }