/// <summary> /// This function called when searching for users finished. /// </summary> private void OnSearchForUsersFinished(HTTPRequest request, HTTPResponse response) { searchStarted = false; if (response != null) { searchText = string.Empty; JsonReader reader = new JsonReader(response.DataAsText); reader.SkipNonMembers = true; searchResult = JsonMapper.ToObject <GithubUserSearchResult>(reader); if (searchResult == null || searchResult.users == null) { GithubMessage msg = JsonMapper.ToObject <GithubMessage>(response.DataAsText); if (msg != null) { searchText = msg.message; } } } else { if (request.Exception != null) { searchText = request.Exception.Message; Debug.LogError(string.Format("{0}: {1}", request.Exception.Message, request.Exception.StackTrace)); } else { searchText = "Search failed!"; } } }
public async Task UpdateGithubRepos(int userId, string username) { try { var model = new GithubMessage { UserId = userId, UserName = username }; await AddJobToQueue(_queueName, model); } catch (Exception e) { _logger.LogError(e, e.Message); } }
public Github(string username, string repositorie, string sha1) { try { string url = sUtilities.GetUrl(string.Format("https://api.github.com/repos/{0}/{1}/git/commits/{2}", username, repositorie, sha1)); var githubA = new GithubAuthor(); githubA = JsonHelper.Deserialise <GithubAuthor>(url); UserName = githubA.AuthorResult.Name; var githubM = new GithubMessage(); githubM = JsonHelper.Deserialise <GithubMessage>(url); Message = githubM.Message.Replace(SchumixBase.NewLine, SchumixBase.Space); Url = string.Format("https://github.com/{0}/{1}/commit/{2}", username, repositorie, sha1); } catch (Exception) { UserName = string.Empty; Message = string.Empty; Url = string.Empty; } }