ユーザー インタラクション
ユーザー インタラクション API を使用すると、自分のパブリック リポジトリでコメント作成、Issue のオープン、pull request の作成を行えるユーザーのタイプを一時的に制限できます。
ユーザー インタラクション API について
ユーザー インタラクション API を使用すると、自分のパブリック リポジトリでコメント作成、Issue のオープン、pull request の作成を行えるユーザーのタイプを一時的に制限できます。 制限が有効化されると、指定した種類のGitHubユーザのみがインタラクションに参加できるようになります。 制限は、定義された期間の後に自動的に期限切れになります。 GitHub ユーザのタイプについては以下を参照してください。
- Existing users(既存のユーザー): インタラクションを
existing_usersに制限すると、24 時間以下しか経過していないアカウントの新規ユーザーで、以前にコントリビューションしておらず、コラボレーターでもないユーザーは、一時的に制限されます。が自分のリポジトリの操作を制限されます。 - Contributors only (共同作成者のみ): 対話を
contributors_onlyに制限すると、以前に投稿していない共同作成者ではないユーザーは一時的に制限されますが自分のリポジトリの操作を制限されます。 - Collaborators only(コラボレーターのみ): インタラクションを
collaborators_onlyに制限すると、コラボレーターではないユーザーは一時的に制限されますが自分のリポジトリの操作を制限されます。
ユーザレベルでインタラクション制限を設定すると、ユーザが所有する個々のリポジトリに設定されているインタラクション制限は上書きされます。 ユーザーが所有する個々のリポジトリに対して異なるインタラクション制限を設定するには、代わりにリポジトリ インタラクション エンドポイントを使ってください。
Get interaction restrictions for your public repositories
Shows which type of GitHub user can interact with your public repositories and when the restriction expires.
HTTP 応答状態コード
| status code | 説明 |
|---|---|
200 | Default response |
204 | Response when there are no restrictions |
コード サンプル
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/user/interaction-limitsDefault response
Status: 200{
"limit": "collaborators_only",
"origin": "organization",
"expires_at": "2018-08-17T04:18:39Z"
}Set interaction restrictions for your public repositories
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.
パラメーター
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Body parameters |
| Name, Type, Description |
limitstringRequiredThe type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: |
expirystringThe duration of the interaction restriction. Default: Can be one of: |
HTTP 応答状態コード
| status code | 説明 |
|---|---|
200 | OK |
422 | Validation failed, or the endpoint has been spammed. |
コード サンプル
curl \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/user/interaction-limitsResponse
Status: 200{
"limit": "collaborators_only",
"origin": "user",
"expires_at": "2018-08-17T04:18:39Z"
}Remove interaction restrictions from your public repositories
Removes any interaction restrictions from your public repositories.
HTTP 応答状態コード
| status code | 説明 |
|---|---|
204 | No Content |
コード サンプル
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/user/interaction-limitsResponse
Status: 204