public void Organization_UpdateInvalid(int limit) { Console.WriteLine($"Update invalid organizations, {nameof(limit)}: {limit}"); var updatedOrgs = new List <Organization>(); try { List <Organization> invalidOrgs = DatabaseManager.Instance.Organization_SelectInvalidAll(limit); if (invalidOrgs.Count == 0) { return; } foreach (Organization org in invalidOrgs) { Console.WriteLine($"Get organization: {org.Login}"); Octokit.Organization o_org = GitHubAPI.Instance.Organization_GetByLogin(org.Login); if (o_org == null) { Console.WriteLine($"Get result is null, skip organization: {org.Login}"); continue; } updatedOrgs.Add(new Organization(o_org, true)); } } catch (Exception e) { Console.WriteLine($"{e.GetType().Name} detected, jump to DB stage"); Console.WriteLine(e); } Console.WriteLine($"Save updated organizations to DB, count: {updatedOrgs.Count}"); DatabaseManager.Instance.Organization_InsertOrUpdate(updatedOrgs); }
public Team(Uri url, int id, string name, Permission permission, int membersCount, int reposCount, Organization organization) { Url = url; Id = id; Name = name; Permission = permission; MembersCount = membersCount; ReposCount = reposCount; Organization = organization; }
public Activity(string type, bool @public, Repository repo, User actor, Organization org, DateTimeOffset createdAt, string id) { Type = type; Public = @public; Repo = repo; Actor = actor; Org = org; CreatedAt = createdAt; Id = id; }
public Octokit.Organization Organization_GetByLogin(string organizationLogin) { for (int tryCount = 1; tryCount <= maximumRequestRetry; tryCount++) { try { lastCoreRequest = DateTime.Now; Octokit.Organization organization = gitHubClient.Organization.Get(organizationLogin).Result; CoreRateLimit = gitHubClient.GetLastApiInfo().RateLimit; return(organization); } catch (AggregateException ae) { HandleAggregateExceptionForCore(tryCount, ae); } } return(null); }
public override IReadOnlyList <string> MergedQualifiers() { var parameters = new List <string>(); if (In != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}", string.Join(",", In.Select(i => i.ToParameter())))); } if (Language != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:{0}", Language.ToParameter())); } if (Forks != null) { // API is expecting 'true', bool.ToString() returns 'True', if there is a better way, // please, oh please let me know... parameters.Add(string.Format(CultureInfo.InvariantCulture, "fork:{0}", Forks.Value.ToString().ToLower())); } if (Size != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "size:{0}", Size)); } if (Path.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "path:{0}", Path)); } if (Extensions.Any()) { foreach (var extension in Extensions) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "extension:{0}", extension)); } } if (FileName.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "filename:{0}", FileName)); } if (User.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User)); } if (Repos.Any()) { var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat()); if (invalidFormatRepos.Any()) { throw new RepositoryFormatException(invalidFormatRepos); } parameters.Add( string.Join("+", Repos.Select(x => "repo:" + x))); } if (Organization.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "org:{0}", Organization)); } return(new ReadOnlyCollection <string>(parameters)); }
public Team(string url, string htmlUrl, int id, string nodeId, string slug, string name, string description, TeamPrivacy privacy, PermissionLevel permission, int membersCount, int reposCount, Organization organization, Team parent, string ldapDistinguishedName) { Url = url; HtmlUrl = htmlUrl; Id = id; NodeId = nodeId; Slug = slug; Name = name; Description = description; Privacy = privacy; Permission = permission; MembersCount = membersCount; ReposCount = reposCount; Organization = organization; Parent = parent; LdapDistinguishedName = ldapDistinguishedName; }
public Team(string url, int id, string name, string description, TeamPrivacy privacy, Permission permission, int membersCount, int reposCount, Organization organization, string ldapDistinguishedName) { Url = url; Id = id; Name = name; Description = description; Privacy = privacy; Permission = permission; MembersCount = membersCount; ReposCount = reposCount; Organization = organization; LdapDistinguishedName = ldapDistinguishedName; }