-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add get and update endpoints for org members (#150)
* feat: expose org membership endpoints * feat: test org endpoints * feat: update comments * feat: update tests
- Loading branch information
Showing
5 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/com/spotify/github/v3/orgs/OrgMembership.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*- | ||
* -\-\- | ||
* github-api | ||
* -- | ||
* Copyright (C) 2016 - 2020 Spotify AB | ||
* -- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* -/-/- | ||
*/ | ||
|
||
package com.spotify.github.v3.orgs; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.spotify.github.GithubStyle; | ||
import com.spotify.github.v3.User; | ||
import com.spotify.github.v3.repos.Organization; | ||
import java.net.URI; | ||
import javax.annotation.Nullable; | ||
import org.immutables.value.Value; | ||
|
||
/** | ||
* Org Membership resource represents data returned by a single Membership get operation. | ||
*/ | ||
@Value.Immutable | ||
@GithubStyle | ||
@JsonSerialize(as = ImmutableOrgMembership.class) | ||
@JsonDeserialize(as = ImmutableOrgMembership.class) | ||
public interface OrgMembership { | ||
|
||
/** URL */ | ||
@Nullable | ||
URI url(); | ||
|
||
/** ROLE */ | ||
@Nullable | ||
String role(); | ||
|
||
/** STATE */ | ||
@Nullable | ||
String state(); | ||
|
||
@Nullable | ||
Organization organization(); | ||
|
||
/** USER */ | ||
@Nullable | ||
User user(); | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/spotify/github/v3/orgs/requests/OrgMembershipCreate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*- | ||
* -\-\- | ||
* github-api | ||
* -- | ||
* Copyright (C) 2016 - 2020 Spotify AB | ||
* -- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* -/-/- | ||
*/ | ||
|
||
package com.spotify.github.v3.orgs.requests; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.spotify.github.GithubStyle; | ||
import javax.annotation.Nullable; | ||
import org.immutables.value.Value; | ||
|
||
/** Request to create a member within a given org */ | ||
@Value.Immutable | ||
@GithubStyle | ||
@JsonSerialize(as = ImmutableOrgMembershipCreate.class) | ||
@JsonDeserialize(as = ImmutableOrgMembershipCreate.class) | ||
public interface OrgMembershipCreate { | ||
|
||
/** | ||
* The role that this user should have in the org. | ||
* Defaults to 'member' | ||
*/ | ||
@Nullable | ||
String role(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/resources/com/spotify/github/v3/clients/org_membership.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"url": "https://api.github.com/orgs/github/memberships/octocat", | ||
"state": "active", | ||
"role": "member", | ||
"organization_url": "https://api.github.com/orgs/octocat", | ||
"organization": { | ||
"login": "github", | ||
"id": 1, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", | ||
"url": "https://api.github.com/orgs/github", | ||
"repos_url": "https://api.github.com/orgs/github/repos", | ||
"events_url": "https://api.github.com/orgs/github/events", | ||
"hooks_url": "https://api.github.com/orgs/github/hooks", | ||
"issues_url": "https://api.github.com/orgs/github/issues", | ||
"members_url": "https://api.github.com/orgs/github/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}", | ||
"avatar_url": "https://github.com/images/error/octocat_happy.gif", | ||
"description": "A great organization" | ||
}, | ||
"user": { | ||
"login": "octocat", | ||
"id": 1, | ||
"node_id": "MDQ6VXNlcjE=", | ||
"avatar_url": "https://github.com/images/error/octocat_happy.gif", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/octocat", | ||
"html_url": "https://github.com/octocat", | ||
"followers_url": "https://api.github.com/users/octocat/followers", | ||
"following_url": "https://api.github.com/users/octocat/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions", | ||
"organizations_url": "https://api.github.com/users/octocat/orgs", | ||
"repos_url": "https://api.github.com/users/octocat/repos", | ||
"events_url": "https://api.github.com/users/octocat/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/octocat/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
} | ||
} |