+
Skip to content

Move the GitHub Teams API #1400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 10, 2020
Merged

Move the GitHub Teams API #1400

merged 11 commits into from
Feb 10, 2020

Conversation

sprsld
Copy link
Contributor

@sprsld sprsld commented Jan 28, 2020

Fixes: #1387.

@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Jan 28, 2020
@sprsld sprsld requested a review from gmlewis January 28, 2020 04:32
@weeco
Copy link

weeco commented Jan 28, 2020

I think this PR is missing (some?) of the new Team API endpoints e. g. fetching a team by it's slug GET /orgs/:org/teams/:team_slug, see: https://developer.github.com/changes/2020-01-21-moving-the-team-api-endpoints/

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 29, 2020

Thank you, @weeco - I've made a list in #1387 so we can hopefully keep track of the changes needed, and the ones that are implemented, as we review the PR(s).

@sprsld
Copy link
Contributor Author

sprsld commented Jan 29, 2020

@weeco - I will go ahead and take a look again. As for the particular endpoint you referenced the implementation for that should be in github/teams.go on line 119. Is that what you are referring to?

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Atorr, but this PR is attempting to do way too much and can not be fully reviewed as written.
As described below, please address the comments reviewed so far, and revert all the unnecessary changes performed in reorganizing the file structure.

Also, please to not use "force push" for any future commits, as that will waste a great deal of time when reviewing. Thanks.

github/teams.go Outdated
// GitHub API docs: https://developer.github.com/v3/teams/#get-team
func (s *TeamsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) {
u := fmt.Sprintf("teams/%v", team)
// Github API docs: https://developer.github.com/v3/teams/#get-team-by-name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Github/GitHub/

github/teams.go Outdated
@@ -239,11 +239,38 @@ func (s *TeamsService) EditTeam(ctx context.Context, id int64, team NewTeam, rem
return t, resp, nil
}

// DeleteTeam deletes a team.
// EditTeamByName edits a team, given an organiation name, by name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, please rename this function to EditTeamBySlug and change comment to say "by slug."

github/teams.go Outdated
// DeleteTeamByName deletes a team reference by Name.
//
// GitHub API docs: https://developer.github.com/v3/teams/#delete-team
func (s *TeamsService) DeleteTeamByName(ctx context.Context, org, slug string) (*Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, please rename this function to DeleteTeamBySlug and change comment to day "reference by slug."

github/teams.go Outdated
@@ -276,11 +316,63 @@ func (s *TeamsService) ListChildTeams(ctx context.Context, teamID int64, opt *Li
return teams, resp, nil
}

// ListTeamRepos lists the repositories that the specified team has access to.
// ListChildTeamsByParentName lists child teams for a parent team given parent name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, please rename this function to ListChildTeamsByParentSlug, and change the comment to say "given parent slug".

github/teams.go Outdated
return repos, resp, nil
}

// ListTeamReposByName lists the repositories given a team name that the specified team has access to.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListTeamReposBySlug... given a team slug.

github/teams.go Outdated
return s.client.Do(ctx, req, nil)
}

// RemoveTeamRepoByName removes a repository from being managed by the specified
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveTeamRepoBySlug...given the team slug.

github/teams.go Outdated
return projects, resp, nil
}

// ListTeamProjectsByName lists the organization projects for a team given the team name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListTeamProjectsBySlug... given the team slug.

github/teams.go Outdated
// as an organization member, the authenticated user must have "read" access to both the team
// and project, or "admin" access to the team or project.
// Note: This endpoint removes the project from the team, but does not delete it.
// AddTeamProjectByName adds an organization project to a team given the team name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddTeamProjectBySlug...given the team slug.

github/teams.go Outdated
}

// CreateOrUpdateIDPGroupConnections creates, updates, or removes a connection between a team
// and an IDP group.
// RemoveTeamProjectByName removes an organization project from a team given team name.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveTeamProjectBySlug...given team slug.

github/teams.go Outdated
@@ -494,77 +686,46 @@ func (s *TeamsService) RemoveTeamProject(ctx context.Context, teamID int64, proj
return s.client.Do(ctx, req, nil)
}

// IDPGroupList represents a list of external identity provider (IDP) groups.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are lines 497 to the end of the file being deleted in this PR?
Oh, it looks like you are also trying to reorganize the files in this PR as well?
Sorry, but please handle file reorganization in a separate PR.

Attempting to address the changes listed in the announcement: https://developer.github.com/changes/2020-01-21-moving-the-team-api-endpoints/
while at the same time reorganizing files and moving code around makes this PR much much larger than it needs to be and is not reviewable as such.

So please keep this PR focused just on the checklist I made in #1387 and revert the rest of the changes and make a separate PR for those. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Must've missed the list. Working on reverting the changes now. Thanks!

…m members and team synchronization endpoints, and make fixes per PR review
@sprsld
Copy link
Contributor Author

sprsld commented Jan 29, 2020

New changes in. Had missed the link to the blog post and went a bit overboard. Will work to pay more attention to what needs to be changed. Thank you all for your patience on this!

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Atorr ... this looks fantastic now!

Thank you so much for all this work you've done! It is tremendously appreciated by myself and by the hundreds (or maybe even thousands) of happy, silent users of this client library! 😄

LGTM.

Awaiting second LGTM before merging.

@gmlewis gmlewis requested a review from gauntface January 29, 2020 04:16
@weeco
Copy link

weeco commented Feb 3, 2020

Is there any chance to get that merged/released soonish?

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 4, 2020

Hi @weeco - this repo is maintained by volunteers and it is difficult to tell when people will have time to review PRs, so I don't have an ETA for you.

I suggest that if you need something right away, you fork the repo and pull in the PR(s) that you need and work off of that.

Thank you for your patience.

Copy link
Collaborator

@wesleimp wesleimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 10, 2020

Thank you, @wesleimp!
Merging.

@gmlewis gmlewis merged commit 2e3e74f into google:master Feb 10, 2020
@coilysiren
Copy link
Contributor

👋 @gmlewis I have a request 🙏 can you post a comment in this PR when there's a release that includes this change? I'd appreciate it tons ✨

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 10, 2020

@lynncyrin - https://github.com/google/go-github/releases/tag/v29.0.3 incorporates this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the move of the GitHub Teams API
6 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载