Skip to content

Commit ca9b533

Browse files
octokitbotgr2m
andauthored
feat: octokit.interactions.{get,set,remove}RestrictionsForAuthenticatedUser(). Deprecates octokit.interactions.{get,set,remove}RestrictionsForYourPublicRepos. Fixes response data types for octokit.markdown.render() and octokit.users.listEmailsForAuthenticated() (#335)
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
1 parent 3f424bc commit ca9b533

12 files changed

+318
-12
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Get interaction restrictions for your public repositories
3+
example: octokit.interactions.getRestrictionsForAuthenticatedUser()
4+
route: GET /user/interaction-limits
5+
scope: interactions
6+
type: API method
7+
---
8+
9+
# Get interaction restrictions for your public repositories
10+
11+
Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response.
12+
13+
```js
14+
octokit.interactions.getRestrictionsForAuthenticatedUser();
15+
```
16+
17+
## Parameters
18+
19+
This endpoint has no parameters
20+
21+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/interactions#get-interaction-restrictions-for-your-public-repositories).

docs/interactions/getRestrictionsForYourPublicRepos.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ type: API method
88

99
# Get interaction restrictions for your public repositories
1010

11+
**Deprecated:** This method has been renamed to interactions.getRestrictionsForAuthenticatedUser
12+
1113
Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response.
1214

1315
```js
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Remove interaction restrictions from your public repositories
3+
example: octokit.interactions.removeRestrictionsForAuthenticatedUser()
4+
route: DELETE /user/interaction-limits
5+
scope: interactions
6+
type: API method
7+
---
8+
9+
# Remove interaction restrictions from your public repositories
10+
11+
Removes any interaction restrictions from your public repositories.
12+
13+
```js
14+
octokit.interactions.removeRestrictionsForAuthenticatedUser();
15+
```
16+
17+
## Parameters
18+
19+
This endpoint has no parameters
20+
21+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/interactions#remove-interaction-restrictions-from-your-public-repositories).

docs/interactions/removeRestrictionsForYourPublicRepos.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ type: API method
88

99
# Remove interaction restrictions from your public repositories
1010

11+
**Deprecated:** This method has been renamed to interactions.removeRestrictionsForAuthenticatedUser
12+
1113
Removes any interaction restrictions from your public repositories.
1214

1315
```js
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Set interaction restrictions for your public repositories
3+
example: octokit.interactions.setRestrictionsForAuthenticatedUser({ limit })
4+
route: PUT /user/interaction-limits
5+
scope: interactions
6+
type: API method
7+
---
8+
9+
# Set interaction restrictions for your public repositories
10+
11+
Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user.
12+
13+
```js
14+
octokit.interactions.setRestrictionsForAuthenticatedUser({
15+
limit,
16+
});
17+
```
18+
19+
## Parameters
20+
21+
<table>
22+
<thead>
23+
<tr>
24+
<th>name</th>
25+
<th>required</th>
26+
<th>description</th>
27+
</tr>
28+
</thead>
29+
<tbody>
30+
<tr><td>limit</td><td>yes</td><td>
31+
32+
The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: `existing_users`, `contributors_only`, `collaborators_only`.
33+
34+
</td></tr>
35+
<tr><td>expiry</td><td>no</td><td>
36+
37+
The duration of the interaction restriction. Can be one of: `one_day`, `three_days`, `one_week`, `one_month`, `six_months`. Default: `one_day`.
38+
39+
</td></tr>
40+
</tbody>
41+
</table>
42+
43+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/interactions#set-interaction-restrictions-for-your-public-repositories).

docs/interactions/setRestrictionsForYourPublicRepos.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ type: API method
88

99
# Set interaction restrictions for your public repositories
1010

11+
**Deprecated:** This method has been renamed to interactions.setRestrictionsForAuthenticatedUser
12+
1113
Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user.
1214

1315
```js

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"author": "Gregor Martynus (https://twitter.com/gr2m)",
2525
"license": "MIT",
2626
"dependencies": {
27-
"@octokit/types": "^6.8.0",
27+
"@octokit/types": "^6.8.1",
2828
"deprecation": "^2.3.1"
2929
},
3030
"devDependencies": {

scripts/update-endpoints/generated/endpoints.json

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14450,6 +14450,32 @@
1445014450
],
1445114451
"renamed": null
1445214452
},
14453+
{
14454+
"name": "Get interaction restrictions for your public repositories",
14455+
"scope": "interactions",
14456+
"id": "getRestrictionsForAuthenticatedUser",
14457+
"method": "GET",
14458+
"url": "/user/interaction-limits",
14459+
"isDeprecated": false,
14460+
"deprecationDate": null,
14461+
"description": "Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response.",
14462+
"documentationUrl": "https://docs.github.com/rest/reference/interactions#get-interaction-restrictions-for-your-public-repositories",
14463+
"previews": [],
14464+
"headers": [],
14465+
"parameters": [],
14466+
"responses": [
14467+
{
14468+
"code": 200,
14469+
"description": "response",
14470+
"examples": [
14471+
{
14472+
"data": "{\"limit\":\"collaborators_only\",\"origin\":\"user\",\"expires_at\":\"2018-08-17T04:18:39Z\"}"
14473+
}
14474+
]
14475+
}
14476+
],
14477+
"renamed": null
14478+
},
1445314479
{
1445414480
"name": "Get interaction restrictions for an organization",
1445514481
"scope": "interactions",
@@ -14567,6 +14593,35 @@
1456714593
]
1456814594
}
1456914595
],
14596+
"renamed": {
14597+
"before": {
14598+
"scope": "interactions",
14599+
"id": "getRestrictionsForYourPublicRepos"
14600+
},
14601+
"after": {
14602+
"scope": "interactions",
14603+
"id": "getRestrictionsForAuthenticatedUser"
14604+
},
14605+
"date": "2021-02-02",
14606+
"note": null
14607+
}
14608+
},
14609+
{
14610+
"name": "Remove interaction restrictions from your public repositories",
14611+
"scope": "interactions",
14612+
"id": "removeRestrictionsForAuthenticatedUser",
14613+
"method": "DELETE",
14614+
"url": "/user/interaction-limits",
14615+
"isDeprecated": false,
14616+
"deprecationDate": null,
14617+
"description": "Removes any interaction restrictions from your public repositories.",
14618+
"documentationUrl": "https://docs.github.com/rest/reference/interactions#remove-interaction-restrictions-from-your-public-repositories",
14619+
"previews": [],
14620+
"headers": [],
14621+
"parameters": [],
14622+
"responses": [
14623+
{ "code": 204, "description": "Empty response", "examples": null }
14624+
],
1457014625
"renamed": null
1457114626
},
1457214627
{
@@ -14663,6 +14718,77 @@
1466314718
"responses": [
1466414719
{ "code": 204, "description": "Empty response", "examples": null }
1466514720
],
14721+
"renamed": {
14722+
"before": {
14723+
"scope": "interactions",
14724+
"id": "removeRestrictionsForYourPublicRepos"
14725+
},
14726+
"after": {
14727+
"scope": "interactions",
14728+
"id": "removeRestrictionsForAuthenticatedUser"
14729+
},
14730+
"date": "2021-02-02",
14731+
"note": null
14732+
}
14733+
},
14734+
{
14735+
"name": "Set interaction restrictions for your public repositories",
14736+
"scope": "interactions",
14737+
"id": "setRestrictionsForAuthenticatedUser",
14738+
"method": "PUT",
14739+
"url": "/user/interaction-limits",
14740+
"isDeprecated": false,
14741+
"deprecationDate": null,
14742+
"description": "Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user.",
14743+
"documentationUrl": "https://docs.github.com/rest/reference/interactions#set-interaction-restrictions-for-your-public-repositories",
14744+
"previews": [],
14745+
"headers": [],
14746+
"parameters": [
14747+
{
14748+
"name": "limit",
14749+
"description": "The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: `existing_users`, `contributors_only`, `collaborators_only`.",
14750+
"in": "BODY",
14751+
"type": "string",
14752+
"required": true,
14753+
"enum": ["existing_users", "contributors_only", "collaborators_only"],
14754+
"allowNull": false,
14755+
"mapToData": null,
14756+
"validation": null,
14757+
"alias": null,
14758+
"deprecated": null
14759+
},
14760+
{
14761+
"name": "expiry",
14762+
"description": "The duration of the interaction restriction. Can be one of: `one_day`, `three_days`, `one_week`, `one_month`, `six_months`. Default: `one_day`.",
14763+
"in": "BODY",
14764+
"type": "string",
14765+
"required": false,
14766+
"enum": [
14767+
"one_day",
14768+
"three_days",
14769+
"one_week",
14770+
"one_month",
14771+
"six_months"
14772+
],
14773+
"allowNull": false,
14774+
"mapToData": null,
14775+
"validation": null,
14776+
"alias": null,
14777+
"deprecated": null
14778+
}
14779+
],
14780+
"responses": [
14781+
{
14782+
"code": 200,
14783+
"description": "response",
14784+
"examples": [
14785+
{
14786+
"data": "{\"limit\":\"collaborators_only\",\"origin\":\"user\",\"expires_at\":\"2018-08-17T04:18:39Z\"}"
14787+
}
14788+
]
14789+
},
14790+
{ "code": 422, "description": "Validation Failed", "examples": null }
14791+
],
1466614792
"renamed": null
1466714793
},
1466814794
{
@@ -14882,7 +15008,18 @@
1488215008
},
1488315009
{ "code": 422, "description": "Validation Failed", "examples": null }
1488415010
],
14885-
"renamed": null
15011+
"renamed": {
15012+
"before": {
15013+
"scope": "interactions",
15014+
"id": "setRestrictionsForYourPublicRepos"
15015+
},
15016+
"after": {
15017+
"scope": "interactions",
15018+
"id": "setRestrictionsForAuthenticatedUser"
15019+
},
15020+
"date": "2021-02-02",
15021+
"note": null
15022+
}
1488615023
},
1488715024
{
1488815025
"name": "Add assignees to an issue",

src/generated/endpoints.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,32 @@ const Endpoints: EndpointsDefaultsAndDecorations = {
381381
getTemplate: ["GET /gitignore/templates/{name}"],
382382
},
383383
interactions: {
384+
getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
384385
getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
385386
getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"],
386-
getRestrictionsForYourPublicRepos: ["GET /user/interaction-limits"],
387+
getRestrictionsForYourPublicRepos: [
388+
"GET /user/interaction-limits",
389+
{},
390+
{ renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] },
391+
],
392+
removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"],
387393
removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"],
388394
removeRestrictionsForRepo: [
389395
"DELETE /repos/{owner}/{repo}/interaction-limits",
390396
],
391-
removeRestrictionsForYourPublicRepos: ["DELETE /user/interaction-limits"],
397+
removeRestrictionsForYourPublicRepos: [
398+
"DELETE /user/interaction-limits",
399+
{},
400+
{ renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] },
401+
],
402+
setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"],
392403
setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"],
393404
setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"],
394-
setRestrictionsForYourPublicRepos: ["PUT /user/interaction-limits"],
405+
setRestrictionsForYourPublicRepos: [
406+
"PUT /user/interaction-limits",
407+
{},
408+
{ renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] },
409+
],
395410
},
396411
issues: {
397412
addAssignees: [

0 commit comments

Comments
 (0)