Skip to content

Move the GitHub Teams API#1400

Merged
gmlewis merged 11 commits into
google:masterfrom
sprsld:issue-1387
Feb 10, 2020
Merged

Move the GitHub Teams API#1400
gmlewis merged 11 commits into
google:masterfrom
sprsld:issue-1387

Conversation

@sprsld

@sprsld sprsld commented Jan 28, 2020

Copy link
Copy Markdown
Contributor

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

weeco commented Jan 28, 2020

Copy link
Copy Markdown

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

gmlewis commented Jan 29, 2020

Copy link
Copy Markdown
Collaborator

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

sprsld commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

@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?

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread 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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/Github/GitHub/

Comment thread github/teams.go Outdated
}

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

Copy link
Copy Markdown
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."

Comment thread 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
Copy Markdown
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."

Comment thread github/teams.go Outdated
}

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

Copy link
Copy Markdown
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".

Comment thread 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
Copy Markdown
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.

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

// RemoveTeamRepoByName removes a repository from being managed by the specified

Copy link
Copy Markdown
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.

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

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

Copy link
Copy Markdown
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.

Comment thread 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
Copy Markdown
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.

Comment thread 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
Copy Markdown
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.

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

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

Copy link
Copy Markdown
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
Copy Markdown
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

sprsld commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

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!

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

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

weeco commented Feb 3, 2020

Copy link
Copy Markdown

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

@gmlewis

gmlewis commented Feb 4, 2020

Copy link
Copy Markdown
Collaborator

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.

@wesleimp wesleimp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👌

@gmlewis

gmlewis commented Feb 10, 2020

Copy link
Copy Markdown
Collaborator

Thank you, @wesleimp!
Merging.

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

Copy link
Copy Markdown
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

gmlewis commented Feb 10, 2020

Copy link
Copy Markdown
Collaborator

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

n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
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.

6 participants