From dd176ff6e6332e37654f69621c2c185832637afa Mon Sep 17 00:00:00 2001 From: Octokit Bot <33075676+octokitbot@users.noreply.github.com> Date: Mon, 2 Aug 2021 10:22:05 -0700 Subject: [PATCH] feat: `.rest.repos.createAutolink()`, `.rest.repos.listAutolinks()`, `.rest.repos.getAutolink()`, `.rest.repos.deleteAutolink()` (#427) --- docs/repos/createAutolink.md | 52 ++++ docs/repos/deleteAutolink.md | 48 ++++ docs/repos/getAutolink.md | 48 ++++ docs/repos/listAutolinks.md | 47 +++ package-lock.json | 14 +- package.json | 2 +- .../update-endpoints/generated/endpoints.json | 272 ++++++++++++++++++ src/generated/endpoints.ts | 4 + src/generated/method-types.ts | 50 ++++ .../parameters-and-response-types.ts | 32 +++ 10 files changed, 561 insertions(+), 8 deletions(-) create mode 100644 docs/repos/createAutolink.md create mode 100644 docs/repos/deleteAutolink.md create mode 100644 docs/repos/getAutolink.md create mode 100644 docs/repos/listAutolinks.md diff --git a/docs/repos/createAutolink.md b/docs/repos/createAutolink.md new file mode 100644 index 000000000..69b2d1603 --- /dev/null +++ b/docs/repos/createAutolink.md @@ -0,0 +1,52 @@ +--- +name: Create an autolink reference for a repository +example: octokit.rest.repos.createAutolink({ owner, repo, key_prefix, url_template }) +route: POST /repos/{owner}/{repo}/autolinks +scope: repos +type: API method +--- + +# Create an autolink reference for a repository + +Users with admin access to the repository can create an autolink. + +```js +octokit.rest.repos.createAutolink({ + owner, + repo, + key_prefix, + url_template, +}); +``` + +## Parameters + + + + + + + + + + + + + + + +
namerequireddescription
owneryes + +
repoyes + +
key_prefixyes + +The prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. + +
url_templateyes + +The URL must contain for the reference number. + +
+ +See also: [GitHub Developer Guide documentation](https://docs.github.com/v3/repos#create-an-autolink). diff --git a/docs/repos/deleteAutolink.md b/docs/repos/deleteAutolink.md new file mode 100644 index 000000000..c1d1083d3 --- /dev/null +++ b/docs/repos/deleteAutolink.md @@ -0,0 +1,48 @@ +--- +name: Delete an autolink reference from a repository +example: octokit.rest.repos.deleteAutolink({ owner, repo, autolink_id }) +route: DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} +scope: repos +type: API method +--- + +# Delete an autolink reference from a repository + +This deletes a single autolink reference by ID that was configured for the given repository. + +Information about autolinks are only available to repository administrators. + +```js +octokit.rest.repos.deleteAutolink({ + owner, + repo, + autolink_id, +}); +``` + +## Parameters + + + + + + + + + + + + + + +
namerequireddescription
owneryes + +
repoyes + +
autolink_idyes + +autolink_id parameter + +
+ +See also: [GitHub Developer Guide documentation](https://docs.github.com/v3/repos#delete-autolink). diff --git a/docs/repos/getAutolink.md b/docs/repos/getAutolink.md new file mode 100644 index 000000000..b65eee3b7 --- /dev/null +++ b/docs/repos/getAutolink.md @@ -0,0 +1,48 @@ +--- +name: Get an autolink reference of a repository +example: octokit.rest.repos.getAutolink({ owner, repo, autolink_id }) +route: GET /repos/{owner}/{repo}/autolinks/{autolink_id} +scope: repos +type: API method +--- + +# Get an autolink reference of a repository + +This returns a single autolink reference by ID that was configured for the given repository. + +Information about autolinks are only available to repository administrators. + +```js +octokit.rest.repos.getAutolink({ + owner, + repo, + autolink_id, +}); +``` + +## Parameters + + + + + + + + + + + + + + +
namerequireddescription
owneryes + +
repoyes + +
autolink_idyes + +autolink_id parameter + +
+ +See also: [GitHub Developer Guide documentation](https://docs.github.com/v3/repos#get-autolink). diff --git a/docs/repos/listAutolinks.md b/docs/repos/listAutolinks.md new file mode 100644 index 000000000..8b33d0683 --- /dev/null +++ b/docs/repos/listAutolinks.md @@ -0,0 +1,47 @@ +--- +name: List all autolinks of a repository +example: octokit.rest.repos.listAutolinks({ owner, repo }) +route: GET /repos/{owner}/{repo}/autolinks +scope: repos +type: API method +--- + +# List all autolinks of a repository + +This returns a list of autolinks configured for the given repository. + +Information about autolinks are only available to repository administrators. + +```js +octokit.rest.repos.listAutolinks({ + owner, + repo, +}); +``` + +## Parameters + + + + + + + + + + + + + + +
namerequireddescription
owneryes + +
repoyes + +
pageno + +Page number of the results to fetch. + +
+ +See also: [GitHub Developer Guide documentation](https://docs.github.com/v3/repos#list-autolinks). diff --git a/package-lock.json b/package-lock.json index 03f1a2e6a..1be4af3cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2215,9 +2215,9 @@ } }, "@octokit/openapi-types": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-9.2.0.tgz", - "integrity": "sha512-c4A1Xm0At+ypvBfEETREu519wLncJYQXvY+dBGg/V5YA51eg5EwdDsPPfcOMG0cuXscqRvsIgIySTmTJUdcTNA==" + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-9.3.0.tgz", + "integrity": "sha512-oz60hhL+mDsiOWhEwrj5aWXTOMVtQgcvP+sRzX4C3cH7WOK9QSAoEtjWh0HdOf6V3qpdgAmUMxnQPluzDWR7Fw==" }, "@octokit/plugin-paginate-rest": { "version": "2.14.0", @@ -2282,11 +2282,11 @@ } }, "@octokit/types": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.22.0.tgz", - "integrity": "sha512-Y8GR0BJHQDpO09qw/ZQpN+DXrFzCWaE0pvK4frDm3zJ+h99AktsFfBoDazbCtHxiL8d0jD8xRH4BeynlKLeChg==", + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.23.0.tgz", + "integrity": "sha512-eG3clC31GSS7K3oBK6C6o7wyXPrkP+mu++eus8CSZdpRytJ5PNszYxudOQ0spWZQ3S9KAtoTG6v1WK5prJcJrA==", "requires": { - "@octokit/openapi-types": "^9.2.0" + "@octokit/openapi-types": "^9.3.0" } }, "@pika/babel-plugin-esm-import-rewrite": { diff --git a/package.json b/package.json index fe3d84ae8..db60e004c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "author": "Gregor Martynus (https://twitter.com/gr2m)", "license": "MIT", "dependencies": { - "@octokit/types": "^6.22.0", + "@octokit/types": "^6.23.0", "deprecation": "^2.3.1" }, "devDependencies": { diff --git a/scripts/update-endpoints/generated/endpoints.json b/scripts/update-endpoints/generated/endpoints.json index 90b17bdc3..97b44dbd3 100644 --- a/scripts/update-endpoints/generated/endpoints.json +++ b/scripts/update-endpoints/generated/endpoints.json @@ -34593,6 +34593,86 @@ ], "renamed": null }, + { + "name": "Create an autolink reference for a repository", + "scope": "repos", + "id": "createAutolink", + "method": "POST", + "url": "/repos/{owner}/{repo}/autolinks", + "isDeprecated": false, + "deprecationDate": null, + "description": "Users with admin access to the repository can create an autolink.", + "documentationUrl": "https://docs.github.com/v3/repos#create-an-autolink", + "previews": [], + "headers": [], + "parameters": [ + { + "name": "owner", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "repo", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "key_prefix", + "description": "The prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.", + "in": "BODY", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "url_template", + "description": "The URL must contain for the reference number.", + "in": "BODY", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + } + ], + "responses": [ + { + "code": 201, + "description": "response", + "examples": [ + { + "data": "{\"id\":1,\"key_prefix\":\"TICKET-\",\"url_template\":\"https://example.com/TICKET?query=\"}" + } + ] + }, + { "code": 422, "description": "Validation failed", "examples": null } + ], + "renamed": null + }, { "name": "Create a commit comment", "scope": "repos", @@ -37234,6 +37314,65 @@ ], "renamed": null }, + { + "name": "Delete an autolink reference from a repository", + "scope": "repos", + "id": "deleteAutolink", + "method": "DELETE", + "url": "/repos/{owner}/{repo}/autolinks/{autolink_id}", + "isDeprecated": false, + "deprecationDate": null, + "description": "This deletes a single autolink reference by ID that was configured for the given repository.\n\nInformation about autolinks are only available to repository administrators.", + "documentationUrl": "https://docs.github.com/v3/repos#delete-autolink", + "previews": [], + "headers": [], + "parameters": [ + { + "name": "owner", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "repo", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "autolink_id", + "description": "autolink_id parameter", + "in": "PATH", + "type": "integer", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + } + ], + "responses": [ + { "code": 204, "description": "Response", "examples": null }, + { "code": 404, "description": "Resource not found", "examples": null } + ], + "renamed": null + }, { "name": "Delete branch protection", "scope": "repos", @@ -38912,6 +39051,73 @@ ], "renamed": null }, + { + "name": "Get an autolink reference of a repository", + "scope": "repos", + "id": "getAutolink", + "method": "GET", + "url": "/repos/{owner}/{repo}/autolinks/{autolink_id}", + "isDeprecated": false, + "deprecationDate": null, + "description": "This returns a single autolink reference by ID that was configured for the given repository.\n\nInformation about autolinks are only available to repository administrators.", + "documentationUrl": "https://docs.github.com/v3/repos#get-autolink", + "previews": [], + "headers": [], + "parameters": [ + { + "name": "owner", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "repo", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "autolink_id", + "description": "autolink_id parameter", + "in": "PATH", + "type": "integer", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + } + ], + "responses": [ + { + "code": 200, + "description": "Response", + "examples": [ + { + "data": "{\"id\":1,\"key_prefix\":\"TICKET-\",\"url_template\":\"https://example.com/TICKET?query=\"}" + } + ] + }, + { "code": 404, "description": "Resource not found", "examples": null } + ], + "renamed": null + }, { "name": "Get a branch", "scope": "repos", @@ -41503,6 +41709,72 @@ ], "renamed": null }, + { + "name": "List all autolinks of a repository", + "scope": "repos", + "id": "listAutolinks", + "method": "GET", + "url": "/repos/{owner}/{repo}/autolinks", + "isDeprecated": false, + "deprecationDate": null, + "description": "This returns a list of autolinks configured for the given repository.\n\nInformation about autolinks are only available to repository administrators.", + "documentationUrl": "https://docs.github.com/v3/repos#list-autolinks", + "previews": [], + "headers": [], + "parameters": [ + { + "name": "owner", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "repo", + "description": "", + "in": "PATH", + "type": "string", + "required": true, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + }, + { + "name": "page", + "description": "Page number of the results to fetch.", + "in": "QUERY", + "type": "integer", + "required": false, + "enum": null, + "allowNull": false, + "mapToData": null, + "validation": null, + "alias": null, + "deprecated": null + } + ], + "responses": [ + { + "code": 200, + "description": "Response", + "examples": [ + { + "data": "[{\"id\":1,\"key_prefix\":\"TICKET-\",\"url_template\":\"https://example.com/TICKET?query=\"}]" + } + ] + } + ], + "renamed": null + }, { "name": "List branches", "scope": "repos", diff --git a/src/generated/endpoints.ts b/src/generated/endpoints.ts index a1033deb0..33079de0e 100644 --- a/src/generated/endpoints.ts +++ b/src/generated/endpoints.ts @@ -1002,6 +1002,7 @@ const Endpoints: EndpointsDefaultsAndDecorations = { compareCommitsWithBasehead: [ "GET /repos/{owner}/{repo}/compare/{basehead}", ], + createAutolink: ["POST /repos/{owner}/{repo}/autolinks"], createCommitComment: [ "POST /repos/{owner}/{repo}/commits/{commit_sha}/comments", ], @@ -1044,6 +1045,7 @@ const Endpoints: EndpointsDefaultsAndDecorations = { deleteAnEnvironment: [ "DELETE /repos/{owner}/{repo}/environments/{environment_name}", ], + deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"], deleteBranchProtection: [ "DELETE /repos/{owner}/{repo}/branches/{branch}/protection", ], @@ -1113,6 +1115,7 @@ const Endpoints: EndpointsDefaultsAndDecorations = { getAppsWithAccessToProtectedBranch: [ "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", ], + getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"], getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], getBranchProtection: [ "GET /repos/{owner}/{repo}/branches/{branch}/protection", @@ -1175,6 +1178,7 @@ const Endpoints: EndpointsDefaultsAndDecorations = { getWebhookDelivery: [ "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}", ], + listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"], listBranches: ["GET /repos/{owner}/{repo}/branches"], listBranchesForHeadCommit: [ "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", diff --git a/src/generated/method-types.ts b/src/generated/method-types.ts index f30092f58..a3308e8d2 100644 --- a/src/generated/method-types.ts +++ b/src/generated/method-types.ts @@ -6083,6 +6083,18 @@ export type RestEndpointMethods = { defaults: RequestInterface["defaults"]; endpoint: EndpointInterface<{ url: string }>; }; + /** + * Users with admin access to the repository can create an autolink. + */ + createAutolink: { + ( + params?: RestEndpointMethodTypes["repos"]["createAutolink"]["parameters"] + ): Promise< + RestEndpointMethodTypes["repos"]["createAutolink"]["response"] + >; + defaults: RequestInterface["defaults"]; + endpoint: EndpointInterface<{ url: string }>; + }; /** * Create a comment for a commit using its `:commit_sha`. * @@ -6423,6 +6435,20 @@ export type RestEndpointMethods = { defaults: RequestInterface["defaults"]; endpoint: EndpointInterface<{ url: string }>; }; + /** + * This deletes a single autolink reference by ID that was configured for the given repository. + * + * Information about autolinks are only available to repository administrators. + */ + deleteAutolink: { + ( + params?: RestEndpointMethodTypes["repos"]["deleteAutolink"]["parameters"] + ): Promise< + RestEndpointMethodTypes["repos"]["deleteAutolink"]["response"] + >; + defaults: RequestInterface["defaults"]; + endpoint: EndpointInterface<{ url: string }>; + }; /** * Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. */ @@ -6748,6 +6774,18 @@ export type RestEndpointMethods = { defaults: RequestInterface["defaults"]; endpoint: EndpointInterface<{ url: string }>; }; + /** + * This returns a single autolink reference by ID that was configured for the given repository. + * + * Information about autolinks are only available to repository administrators. + */ + getAutolink: { + ( + params?: RestEndpointMethodTypes["repos"]["getAutolink"]["parameters"] + ): Promise; + defaults: RequestInterface["defaults"]; + endpoint: EndpointInterface<{ url: string }>; + }; getBranch: { ( @@ -7294,6 +7332,18 @@ export type RestEndpointMethods = { defaults: RequestInterface["defaults"]; endpoint: EndpointInterface<{ url: string }>; }; + /** + * This returns a list of autolinks configured for the given repository. + * + * Information about autolinks are only available to repository administrators. + */ + listAutolinks: { + ( + params?: RestEndpointMethodTypes["repos"]["listAutolinks"]["parameters"] + ): Promise; + defaults: RequestInterface["defaults"]; + endpoint: EndpointInterface<{ url: string }>; + }; listBranches: { ( diff --git a/src/generated/parameters-and-response-types.ts b/src/generated/parameters-and-response-types.ts index 18769f5db..3ec75fe62 100644 --- a/src/generated/parameters-and-response-types.ts +++ b/src/generated/parameters-and-response-types.ts @@ -3570,6 +3570,14 @@ export type RestEndpointMethodTypes = { >; response: Endpoints["GET /repos/{owner}/{repo}/compare/{basehead}"]["response"]; }; + createAutolink: { + parameters: RequestParameters & + Omit< + Endpoints["POST /repos/{owner}/{repo}/autolinks"]["parameters"], + "baseUrl" | "headers" | "mediaType" + >; + response: Endpoints["POST /repos/{owner}/{repo}/autolinks"]["response"]; + }; createCommitComment: { parameters: RequestParameters & Omit< @@ -3738,6 +3746,14 @@ export type RestEndpointMethodTypes = { >; response: Endpoints["DELETE /repos/{owner}/{repo}/environments/{environment_name}"]["response"]; }; + deleteAutolink: { + parameters: RequestParameters & + Omit< + Endpoints["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"]["parameters"], + "baseUrl" | "headers" | "mediaType" + >; + response: Endpoints["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"]["response"]; + }; deleteBranchProtection: { parameters: RequestParameters & Omit< @@ -3946,6 +3962,14 @@ export type RestEndpointMethodTypes = { >; response: Endpoints["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"]["response"]; }; + getAutolink: { + parameters: RequestParameters & + Omit< + Endpoints["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"]["parameters"], + "baseUrl" | "headers" | "mediaType" + >; + response: Endpoints["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"]["response"]; + }; getBranch: { parameters: RequestParameters & Omit< @@ -4258,6 +4282,14 @@ export type RestEndpointMethodTypes = { >; response: Endpoints["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"]["response"]; }; + listAutolinks: { + parameters: RequestParameters & + Omit< + Endpoints["GET /repos/{owner}/{repo}/autolinks"]["parameters"], + "baseUrl" | "headers" | "mediaType" + >; + response: Endpoints["GET /repos/{owner}/{repo}/autolinks"]["response"]; + }; listBranches: { parameters: RequestParameters & Omit<