-
-
Save peted70/b3ed42aa14ea9324ed05b22d5b2c693b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task<string> GetActivity(string token, string activity, DateTime Start, DateTime end) | |
{ | |
string res = string.Empty; | |
try | |
{ | |
res = await MakeRequestAsync(token, "me/Activities/", | |
string.Format("startTime={0}&endTime={1}&activityTypes={2}&ActivityIncludes=Details", | |
Start.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"), | |
end.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"), | |
activity)); | |
} | |
catch (Exception ex) | |
{ | |
return $"API Request Error - {ex.Message}"; | |
} | |
await Task.Run(() => | |
{ | |
// Format the JSON string | |
var obj = JsonConvert.DeserializeObject(res); | |
res = JsonConvert.SerializeObject(obj, Formatting.Indented); | |
}); | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment