Skip to content
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

Support preview Nested Teams API #714

Closed
gmlewis opened this issue Sep 7, 2017 · 8 comments
Closed

Support preview Nested Teams API #714

gmlewis opened this issue Sep 7, 2017 · 8 comments

Comments

@gmlewis
Copy link
Collaborator

gmlewis commented Sep 7, 2017

GitHub Announcement:
https://developer.github.com/changes/2017-08-30-preview-nested-teams/

This involves adding new endpoints and changing existing endpoints according to the blog post.

Successful completion and closing of this issue involves addressing all the changes described in the GitHub announcement. Note that it doesn't have to all be done in a single PR. It is always a good idea to carefully document what portions are being addressed in any given PR and if there is still work yet to be done.

Thank you in advance for contributing to this open source project!
Your assistance is greatly appreciated.

@elliott-beach
Copy link
Contributor

I'd like to start working on this.
Currently I'm assigned to #715 but that is quite an insubstantial change.

@dmitshur
Copy link
Member

dmitshur commented Sep 9, 2017

Awesome, thanks @e-beach!

@dmitshur
Copy link
Member

dmitshur commented Sep 9, 2017

As Glenn said, this doesn't have to be resolved in a single PR if that would make it large. If so, it'd be better to break it into a few smaller independent changes, as long as that's possible and doing so makes sense.

@elliott-beach
Copy link
Contributor

I will be creating a NewTeam struct for the params passed to CreateTeam and EditTeam, which now differ from the Team response because of the parent(in response) and parent_team_id(in request) fields. https://developer.github.com/v3/orgs/teams/#parameters

I also noticed that the repo_names parameter to CreateTeam is not supported by go-github currently, so it will also go in that struct.

elliott-beach added a commit to elliott-beach/go-github that referenced this issue Sep 22, 2017
dmitshur pushed a commit that referenced this issue Sep 22, 2017
Create mediaTypeNestedTeamsPreview const for
https://developer.github.com/changes/2017-08-30-preview-nested-teams/.

Add parent field to the Team struct.

Set preview API media type in endpoints that return a team, so that
the new parent field gets populated.

Helps #714.
elliott-beach added a commit to elliott-beach/go-github that referenced this issue Sep 26, 2017
Create mediaTypeNestedTeamsPreview const for
https://developer.github.com/changes/2017-08-30-preview-nested-teams/.

Add parent field to the Team struct.

Set preview API media type in endpoints that return a team, so that
the new parent field gets populated.

Helps google#714.
dmitshur pushed a commit that referenced this issue Oct 3, 2017
This replaces Team with NewTeam in function that accept a team for
creating or editing a team. The NewTeam struct is similar to the
existing NewPullRequest for creating pull requests.

We need a new struct because the set of parameters for creating or
editing a team contains some parameters that are not in the parameter
for teams, and most properties of teams cannot be used for editing.

The specific change is that Teams are returned with a parent field,
but are created/edited with a parent_id field.

Helps #714.
@alindeman
Copy link
Contributor

alindeman commented Oct 7, 2017

@e-beach Is there anything left to implement? I'm wondering when the branch can be merged to master, and I'm glad to jump in to help if needed.

@elliott-beach
Copy link
Contributor

@alindeman Thanks for the ping. Yes, #741 finished up support for the API, and this can be merged.
/cc @shurcooL @gmlewis .

@gmlewis
Copy link
Collaborator Author

gmlewis commented Oct 9, 2017

OK, merging NestedTeamsPreview branch to master.

See #747.

dmitshur pushed a commit that referenced this issue Oct 16, 2017
Create mediaTypeNestedTeamsPreview const for
https://developer.github.com/changes/2017-08-30-preview-nested-teams/.

Add parent field to the Team struct.

Set preview API media type in endpoints that return a team, so that
the new parent field gets populated.

Helps #714.
dmitshur pushed a commit that referenced this issue Oct 16, 2017
This replaces Team with NewTeam in function that accept a team for
creating or editing a team. The NewTeam struct is similar to the
existing NewPullRequest for creating pull requests.

We need a new struct because the set of parameters for creating or
editing a team contains some parameters that are not in the parameter
for teams, and most properties of teams cannot be used for editing.

The specific change is that Teams are returned with a parent field,
but are created/edited with a parent_id field.

Helps #714.
@gmlewis
Copy link
Collaborator Author

gmlewis commented Oct 26, 2017

Merging got sidetracked - checking on status with @elliott-beach.

Meanwhile, there is a new GitHub API announcement:
https://developer.github.com/changes/2017-10-13-update-the-nested-teams-preview/

This means that around line 34 of orgs_teams.go:

// Default is "secret".

should be changed to:

// Default is "closed".

This documentation change can happen in a separate PR.

nbareil pushed a commit to nbareil/go-github that referenced this issue May 1, 2018
* Add support for fetching parent team (for nested teams). (google#723)

Create mediaTypeNestedTeamsPreview const for
https://developer.github.com/changes/2017-08-30-preview-nested-teams/.

Add parent field to the Team struct.

Set preview API media type in endpoints that return a team, so that
the new parent field gets populated.

Helps google#714.

* Add NewTeam struct. (google#724)

This replaces Team with NewTeam in function that accept a team for
creating or editing a team. The NewTeam struct is similar to the
existing NewPullRequest for creating pull requests.

We need a new struct because the set of parameters for creating or
editing a team contains some parameters that are not in the parameter
for teams, and most properties of teams cannot be used for editing.

The specific change is that Teams are returned with a parent field,
but are created/edited with a parent_id field.

Helps google#714.

* Add NestedTeamsPreview header to remaining endpoints

Fixes google#714.

* Change ParentTeamID field to int (from string). (google#748)

Using the code as written in the `NestedTeamsPreview` branch produces
an error when talking to the GitHub API:

	panic: PATCH https://api.github.com/teams/2514825: 422 Invalid request.

	For 'properties/parent_team_id', "2514824" is not a number or null. []

The documentation at https://developer.github.com/v3/orgs/teams/#create-team
states that this parameter is an id type which appears to mean an integer, not a string.
Also, id is an integer in the sample responses for Get team endpoint, etc.

* Bump libraryVersion

* NestedTeamsPreview: Add the ListChildTeams endpoint (google#758)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants