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

Commit 40e5d04

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent 3293b3e commit 40e5d04

File tree

6 files changed

+156
-1
lines changed

6 files changed

+156
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: API changes for Repository Invitations
3+
author_name: CoralineAda
4+
---
5+
6+
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.
7+
8+
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:
9+
10+
application/vnd.github.swamp-thing-preview
11+
12+
For example:
13+
14+
``` command-line
15+
curl "https://api.github.com/api/v3/repositories/1313/invitations" \
16+
-H 'Authorization: token TOKEN' \
17+
-H "Accept: application/vnd.github.swamp-thing-preview" \
18+
```
19+
20+
You can learn more about the new endpoints in the updated [Collaborators][collaborators] and new [Repository Invitations][repo-invitations] documentation.
21+
22+
If you have any questions or feedback, please [let us know][contact].
23+
24+
[media-type]: /v3/media
25+
[collaborators]: /v3/repos/collaborators
26+
[repo-invitations]: /v3/repos/invitations
27+
[repo-invitations-announcement]: https://github.com/blog/2170-repository-invitations
28+
[contact]: https://github.com/contact?form%5Bsubject%5D=Reactions+Repository+Invitations+API+Preview

content/v3/oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Name | Description
196196
`user:email`| Grants read access to a user's email addresses.
197197
`user:follow`| Grants access to follow or unfollow other users.
198198
`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.
199-
`repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public and private repositories and organizations.
199+
`repo`| Grants read/write access to code, commit statuses, repository invitations, collaborators, and deployment statuses for public and private repositories and organizations.
200200
`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.
201201
`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.
202202
`delete_repo`| Grants access to delete adminable repositories.

content/v3/repos/collaborators.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ Name | Type | Description
6969

7070
<%= fetch_content(:optional_put_content_length) %>
7171

72+
{{#tip}}
73+
74+
We're currently offering a preview period allowing applications to opt in to the Repository Invitations API.
75+
76+
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:
77+
78+
```
79+
application/vnd.github.swamp-thing-preview+json
80+
```
81+
82+
{{/tip}}
7283

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

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

99110
<%= headers 204 %>
100111

112+
### Response with preview media type
113+
114+
<%= headers 200 %>
115+
<%= json(:repository_invitation) { |h| [h] } %>
116+
101117
## Remove user as a collaborator
102118

103119
DELETE /repos/:owner/:repo/collaborators/:username

content/v3/repos/invitations.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: Repository Invitations
3+
---
4+
5+
# Repository Invitations
6+
7+
{{#tip}}
8+
9+
We're currently offering a preview of the Repository Invitations API.
10+
11+
To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
12+
13+
```
14+
application/vnd.github.swamp-thing-preview+json
15+
```
16+
17+
{{/tip}}
18+
19+
{:toc}
20+
21+
<a id="invite" />
22+
23+
## Invite a user to a repository
24+
25+
Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators).
26+
27+
<a id="list" />
28+
29+
## List invitations for a repository
30+
31+
GET /repositories/:repo_id/invitations
32+
33+
When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.
34+
35+
### Response
36+
37+
<%= headers 200, :pagination => default_pagination_rels %>
38+
<%= json(:repository_invitation) { |h| [h] } %>
39+
40+
<a id="uninvite" />
41+
42+
## Delete a repository invitation
43+
44+
DELETE /repositories/:repo_id/invitations/:invitation_id
45+
46+
### Response
47+
48+
<%= headers 204 %>
49+
50+
<a id="update" />
51+
52+
## Update a repository invitation
53+
54+
PATCH /repositories/:repo_id/invitations/:invitation_id
55+
56+
### Input
57+
58+
Name | Type | Description
59+
-----|------|--------------
60+
`permissions`|`string` | The permissions that the associated user will have on the repository. Valid values are `read`, `write`, and `admin`.
61+
62+
### Response
63+
64+
<%= headers 200 %>
65+
<%= json(:repository_invitation) %>
66+
67+
<a id="my-invitations" />
68+
69+
## List a user's repository invitations
70+
71+
GET /user/repository_invitations
72+
73+
When authenticating as a user, this endpoint will list all currently open repository invitations for that user.
74+
75+
### Response
76+
77+
<%= headers 200 %>
78+
<%= json(:repository_invitation) { |h| [h] } %>
79+
80+
<a id="accept" />
81+
82+
## Accept a repository invitation
83+
84+
PATCH /repositories/:repo_id/invitations/:invitation_id
85+
86+
### Response
87+
88+
<%= headers 204 %>
89+
90+
<a id="decline" />
91+
92+
## Decline a repository invitation
93+
94+
DELETE /repositories/:repo_id/invitations/:invitation_id
95+
96+
### Response
97+
98+
<%= headers 204 %>

layouts/sidebar.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ <h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></
106106
<li><a href="/v3/repos/deployments/">Deployments</a></li>
107107
<li><a href="/v3/repos/downloads/">Downloads</a></li>
108108
<li><a href="/v3/repos/forks/">Forks</a></li>
109+
<li><a href="/v3/repos/invitations/">Invitations</a></li>
109110
<li><a href="/v3/repos/merging/">Merging</a></li>
110111
<li><a href="/v3/repos/pages/">Pages</a></li>
111112
<li><a href="/v3/repos/releases/">Releases</a></li>

lib/responses/repos.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ module Responses
134134
[0,1,43],
135135
[0,2,21]
136136
]
137+
138+
REPOSITORY_INVITATION ||= {
139+
"id" => 1,
140+
"repository" => REPO,
141+
"invitee" => USER,
142+
"inviter" => USER,
143+
"permissions" => "write",
144+
"created_at" => "2016-06-13T14:52:50-05:00",
145+
"url" => "https://api.github.com/api/v3/repositories/1296269/invitations/",
146+
"html_url" => "#{SIMPLE_REPO['html_url']}/invitations"
147+
}
148+
137149
end
138150
end
139151
end

0 commit comments

Comments
 (0)