Skip to content

Commit e166936

Browse files
octokitbotgr2m
andauthored
feat: .packages.deletePackageForUser(), .packages.deletePackageVersionForUser(), .packages.restorePackageForUser(), .packages.restorePackageVersionForUser(), .secretScanning.listAlertsForOrg() (#433)
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
1 parent bc507b0 commit e166936

15 files changed

+3089
-325
lines changed

docs/issues/setLabels.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Set labels for an issue
3-
example: octokit.rest.issues.setLabels({ owner, repo, issue_number })
3+
example: octokit.rest.issues.setLabels({ owner, repo, issue_number, labels[].name })
44
route: PUT /repos/{owner}/{repo}/issues/{issue_number}/labels
55
scope: issues
66
type: API method
@@ -12,10 +12,11 @@ Removes any previous labels and sets the new labels for an issue.
1212

1313
```js
1414
octokit.rest.issues.setLabels({
15-
owner,
16-
repo,
17-
issue_number,
18-
});
15+
owner,
16+
repo,
17+
issue_number,
18+
labels[].name
19+
})
1920
```
2021

2122
## Parameters
@@ -39,6 +40,12 @@ octokit.rest.issues.setLabels({
3940

4041
issue_number parameter
4142

43+
</td></tr>
44+
<tr><td>labels</td><td>no</td><td>
45+
46+
</td></tr>
47+
<tr><td>labels[].name</td><td>yes</td><td>
48+
4249
</td></tr>
4350
</tbody>
4451
</table>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Delete a package for a user
3+
example: octokit.rest.packages.deletePackageForUser({ package_type, package_name, username })
4+
route: DELETE /users/{username}/packages/{package_type}/{package_name}
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# Delete a package for a user
10+
11+
Deletes an entire package for a user. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.
12+
13+
To use this endpoint, you must authenticate using an access token with the `packages:read` and `packages:delete` scopes. In addition:
14+
15+
- If `package_type` is not `container`, your token must also include the `repo` scope.
16+
- If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
17+
18+
```js
19+
octokit.rest.packages.deletePackageForUser({
20+
package_type,
21+
package_name,
22+
username,
23+
});
24+
```
25+
26+
## Parameters
27+
28+
<table>
29+
<thead>
30+
<tr>
31+
<th>name</th>
32+
<th>required</th>
33+
<th>description</th>
34+
</tr>
35+
</thead>
36+
<tbody>
37+
<tr><td>package_type</td><td>yes</td><td>
38+
39+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
40+
41+
</td></tr>
42+
<tr><td>package_name</td><td>yes</td><td>
43+
44+
The name of the package.
45+
46+
</td></tr>
47+
<tr><td>username</td><td>yes</td><td>
48+
49+
</td></tr>
50+
</tbody>
51+
</table>
52+
53+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#delete-a-package-for-a-user).
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Delete package version for a user
3+
example: octokit.rest.packages.deletePackageVersionForUser({ package_type, package_name, username, package_version_id })
4+
route: DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# Delete package version for a user
10+
11+
Deletes a specific package version for a user. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
12+
13+
To use this endpoint, you must authenticate using an access token with the `packages:read` and `packages:delete` scopes. In addition:
14+
15+
- If `package_type` is not `container`, your token must also include the `repo` scope.
16+
- If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
17+
18+
```js
19+
octokit.rest.packages.deletePackageVersionForUser({
20+
package_type,
21+
package_name,
22+
username,
23+
package_version_id,
24+
});
25+
```
26+
27+
## Parameters
28+
29+
<table>
30+
<thead>
31+
<tr>
32+
<th>name</th>
33+
<th>required</th>
34+
<th>description</th>
35+
</tr>
36+
</thead>
37+
<tbody>
38+
<tr><td>package_type</td><td>yes</td><td>
39+
40+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
41+
42+
</td></tr>
43+
<tr><td>package_name</td><td>yes</td><td>
44+
45+
The name of the package.
46+
47+
</td></tr>
48+
<tr><td>username</td><td>yes</td><td>
49+
50+
</td></tr>
51+
<tr><td>package_version_id</td><td>yes</td><td>
52+
53+
Unique identifier of the package version.
54+
55+
</td></tr>
56+
</tbody>
57+
</table>
58+
59+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#delete-a-package-version-for-a-user).
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: List packages for the authenticated user's namespace
3+
example: octokit.rest.packages.listPackagesForAuthenticatedUser({ package_type })
4+
route: GET /user/packages
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# List packages for the authenticated user's namespace
10+
11+
Lists packages owned by the authenticated user within the user's namespace.
12+
13+
To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
14+
If `package_type` is not `container`, your token must also include the `repo` scope.
15+
16+
```js
17+
octokit.rest.packages.listPackagesForAuthenticatedUser({
18+
package_type,
19+
});
20+
```
21+
22+
## Parameters
23+
24+
<table>
25+
<thead>
26+
<tr>
27+
<th>name</th>
28+
<th>required</th>
29+
<th>description</th>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<tr><td>package_type</td><td>yes</td><td>
34+
35+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
36+
37+
</td></tr>
38+
<tr><td>visibility</td><td>no</td><td>
39+
40+
The selected visibility of the packages. Can be one of `public`, `private`, or `internal`. Only `container` package_types currently support `internal` visibility properly. For other ecosystems `internal` is synonymous with `private`. This parameter is optional and only filters an existing result set.
41+
42+
</td></tr>
43+
</tbody>
44+
</table>
45+
46+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#list-packages-for-the-authenticated-user).
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: List packages for an organization
3+
example: octokit.rest.packages.listPackagesForOrganization({ package_type, org })
4+
route: GET /orgs/{org}/packages
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# List packages for an organization
10+
11+
Lists all packages in an organization readable by the user.
12+
13+
To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
14+
If `package_type` is not `container`, your token must also include the `repo` scope.
15+
16+
```js
17+
octokit.rest.packages.listPackagesForOrganization({
18+
package_type,
19+
org,
20+
});
21+
```
22+
23+
## Parameters
24+
25+
<table>
26+
<thead>
27+
<tr>
28+
<th>name</th>
29+
<th>required</th>
30+
<th>description</th>
31+
</tr>
32+
</thead>
33+
<tbody>
34+
<tr><td>package_type</td><td>yes</td><td>
35+
36+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
37+
38+
</td></tr>
39+
<tr><td>org</td><td>yes</td><td>
40+
41+
</td></tr>
42+
<tr><td>visibility</td><td>no</td><td>
43+
44+
The selected visibility of the packages. Can be one of `public`, `private`, or `internal`. Only `container` package_types currently support `internal` visibility properly. For other ecosystems `internal` is synonymous with `private`. This parameter is optional and only filters an existing result set.
45+
46+
</td></tr>
47+
</tbody>
48+
</table>
49+
50+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#list-packages-for-an-organization).
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: List packages for a user
3+
example: octokit.rest.packages.listPackagesForUser({ package_type, username })
4+
route: GET /user/{username}/packages
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# List packages for a user
10+
11+
Lists all packages in a user's namespace for which the requesting user has access.
12+
13+
To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
14+
If `package_type` is not `container`, your token must also include the `repo` scope.
15+
16+
```js
17+
octokit.rest.packages.listPackagesForUser({
18+
package_type,
19+
username,
20+
});
21+
```
22+
23+
## Parameters
24+
25+
<table>
26+
<thead>
27+
<tr>
28+
<th>name</th>
29+
<th>required</th>
30+
<th>description</th>
31+
</tr>
32+
</thead>
33+
<tbody>
34+
<tr><td>package_type</td><td>yes</td><td>
35+
36+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
37+
38+
</td></tr>
39+
<tr><td>visibility</td><td>no</td><td>
40+
41+
The selected visibility of the packages. Can be one of `public`, `private`, or `internal`. Only `container` package_types currently support `internal` visibility properly. For other ecosystems `internal` is synonymous with `private`. This parameter is optional and only filters an existing result set.
42+
43+
</td></tr>
44+
<tr><td>username</td><td>yes</td><td>
45+
46+
</td></tr>
47+
</tbody>
48+
</table>
49+
50+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#list-packages-for-user).
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: Restore a package for a user
3+
example: octokit.rest.packages.restorePackageForUser({ package_type, package_name, username })
4+
route: POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}
5+
scope: packages
6+
type: API method
7+
---
8+
9+
# Restore a package for a user
10+
11+
Restores an entire package for a user.
12+
13+
You can restore a deleted package under the following conditions:
14+
15+
- The package was deleted within the last 30 days.
16+
- The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
17+
18+
To use this endpoint, you must authenticate using an access token with the `packages:read` and `packages:write` scopes. In addition:
19+
20+
- If `package_type` is not `container`, your token must also include the `repo` scope.
21+
- If `package_type` is `container`, you must also have admin permissions to the container that you want to restore.
22+
23+
```js
24+
octokit.rest.packages.restorePackageForUser({
25+
package_type,
26+
package_name,
27+
username,
28+
});
29+
```
30+
31+
## Parameters
32+
33+
<table>
34+
<thead>
35+
<tr>
36+
<th>name</th>
37+
<th>required</th>
38+
<th>description</th>
39+
</tr>
40+
</thead>
41+
<tbody>
42+
<tr><td>package_type</td><td>yes</td><td>
43+
44+
The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.
45+
46+
</td></tr>
47+
<tr><td>package_name</td><td>yes</td><td>
48+
49+
The name of the package.
50+
51+
</td></tr>
52+
<tr><td>username</td><td>yes</td><td>
53+
54+
</td></tr>
55+
<tr><td>token</td><td>no</td><td>
56+
57+
package token
58+
59+
</td></tr>
60+
</tbody>
61+
</table>
62+
63+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/packages#restore-a-package-for-a-user).

0 commit comments

Comments
 (0)