Skip to content
This repository has been archived by the owner on Nov 1, 2017. It is now read-only.

Commit

Permalink
Sync changes from upstream repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Hubot committed Jun 16, 2016
1 parent 3293b3e commit 40e5d04
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 1 deletion.
28 changes: 28 additions & 0 deletions content/changes/2016-06-14-repository-invitations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: API changes for Repository Invitations
author_name: CoralineAda
---

We announced [repository invitation functionality][repo-invitations-announcement] on May 23. Using the site, you can invite collaborators to work on your repository. Invitees will receive an email with the invitation and have the option to accept or decline.

We have now have endpoints for managing repository invitations for both repository administrators and invitation recipients through the GitHub API. You can enable these changes during the preview period by providing a custom [media type][media-type] in the `Accept` header:

application/vnd.github.swamp-thing-preview

For example:

``` command-line
curl "https://api.github.com/api/v3/repositories/1313/invitations" \
-H 'Authorization: token TOKEN' \
-H "Accept: application/vnd.github.swamp-thing-preview" \
```

You can learn more about the new endpoints in the updated [Collaborators][collaborators] and new [Repository Invitations][repo-invitations] documentation.

If you have any questions or feedback, please [let us know][contact].

[media-type]: /v3/media
[collaborators]: /v3/repos/collaborators
[repo-invitations]: /v3/repos/invitations
[repo-invitations-announcement]: https://github.com/blog/2170-repository-invitations
[contact]: https://github.com/contact?form%5Bsubject%5D=Reactions+Repository+Invitations+API+Preview
2 changes: 1 addition & 1 deletion content/v3/oauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Name | Description
`user:email`| Grants read access to a user's email addresses.
`user:follow`| Grants access to follow or unfollow other users.
`public_repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations. Also required for starring public repositories.
`repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public and private repositories and organizations.
`repo`| Grants read/write access to code, commit statuses, repository invitations, collaborators, and deployment statuses for public and private repositories and organizations.
`repo_deployment`| Grants access to [deployment statuses][deployments] for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, *without* granting access to the code.
`repo:status`| Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses *without* granting access to the code.
`delete_repo`| Grants access to delete adminable repositories.
Expand Down
16 changes: 16 additions & 0 deletions content/v3/repos/collaborators.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ Name | Type | Description

<%= fetch_content(:optional_put_content_length) %>

{{#tip}}

We're currently offering a preview period allowing applications to opt in to the Repository Invitations API.

To send an invitation to a collaborator rather than directly adding them, you must provide a custom [media type](/v3/media) in the `Accept` header:

```
application/vnd.github.swamp-thing-preview+json
```

{{/tip}}

{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}

Expand Down Expand Up @@ -98,6 +109,11 @@ application/vnd.github.ironman-preview+json

<%= headers 204 %>

### Response with preview media type

<%= headers 200 %>
<%= json(:repository_invitation) { |h| [h] } %>

## Remove user as a collaborator

DELETE /repos/:owner/:repo/collaborators/:username
Expand Down
98 changes: 98 additions & 0 deletions content/v3/repos/invitations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: Repository Invitations
---

# Repository Invitations

{{#tip}}

We're currently offering a preview of the Repository Invitations API.

To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:

```
application/vnd.github.swamp-thing-preview+json
```

{{/tip}}

{:toc}

<a id="invite" />

## Invite a user to a repository

Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators).

<a id="list" />

## List invitations for a repository

GET /repositories/:repo_id/invitations

When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.

### Response

<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:repository_invitation) { |h| [h] } %>

<a id="uninvite" />

## Delete a repository invitation

DELETE /repositories/:repo_id/invitations/:invitation_id

### Response

<%= headers 204 %>

<a id="update" />

## Update a repository invitation

PATCH /repositories/:repo_id/invitations/:invitation_id

### Input

Name | Type | Description
-----|------|--------------
`permissions`|`string` | The permissions that the associated user will have on the repository. Valid values are `read`, `write`, and `admin`.

### Response

<%= headers 200 %>
<%= json(:repository_invitation) %>

<a id="my-invitations" />

## List a user's repository invitations

GET /user/repository_invitations

When authenticating as a user, this endpoint will list all currently open repository invitations for that user.

### Response

<%= headers 200 %>
<%= json(:repository_invitation) { |h| [h] } %>

<a id="accept" />

## Accept a repository invitation

PATCH /repositories/:repo_id/invitations/:invitation_id

This comment has been minimized.

Copy link
@Shredder121

Shredder121 Jun 16, 2016

Contributor

Why is this the same url as the Update a repository invitation?

This comment has been minimized.

Copy link
@MikeMcQuaid

MikeMcQuaid Jun 17, 2016

Contributor

This was fixed in 094b17c.

This comment has been minimized.

Copy link
@Shredder121

Shredder121 Jun 17, 2016

Contributor

Ah okay, nice. 👍
Keep up the good work!


### Response

<%= headers 204 %>

<a id="decline" />

## Decline a repository invitation

DELETE /repositories/:repo_id/invitations/:invitation_id

### Response

<%= headers 204 %>
1 change: 1 addition & 0 deletions layouts/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ <h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></
<li><a href="/v3/repos/deployments/">Deployments</a></li>
<li><a href="/v3/repos/downloads/">Downloads</a></li>
<li><a href="/v3/repos/forks/">Forks</a></li>
<li><a href="/v3/repos/invitations/">Invitations</a></li>
<li><a href="/v3/repos/merging/">Merging</a></li>
<li><a href="/v3/repos/pages/">Pages</a></li>
<li><a href="/v3/repos/releases/">Releases</a></li>
Expand Down
12 changes: 12 additions & 0 deletions lib/responses/repos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ module Responses
[0,1,43],
[0,2,21]
]

REPOSITORY_INVITATION ||= {
"id" => 1,
"repository" => REPO,
"invitee" => USER,
"inviter" => USER,
"permissions" => "write",
"created_at" => "2016-06-13T14:52:50-05:00",
"url" => "https://api.github.com/api/v3/repositories/1296269/invitations/",
"html_url" => "#{SIMPLE_REPO['html_url']}/invitations"
}

end
end
end

0 comments on commit 40e5d04

Please sign in to comment.