diff --git a/lib/rest/static/apps/enabled-for-apps.json b/lib/rest/static/apps/enabled-for-apps.json index 1398a72cac..91dd7fac54 100644 --- a/lib/rest/static/apps/enabled-for-apps.json +++ b/lib/rest/static/apps/enabled-for-apps.json @@ -946,7 +946,33 @@ "requestPath": "/codes_of_conduct/{key}" } ], - "codespaces": [], + "codespaces": [ + { + "slug": "list-available-machine-types-for-a-repository", + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/machines" + }, + { + "slug": "list-repository-secrets", + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets" + }, + { + "slug": "get-a-repository-secret", + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}" + }, + { + "slug": "create-or-update-a-repository-secret", + "verb": "put", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}" + }, + { + "slug": "delete-a-repository-secret", + "verb": "delete", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}" + } + ], "collaborators": [ { "slug": "list-repository-collaborators", diff --git a/lib/rest/static/decorated/api.github.com.json b/lib/rest/static/decorated/api.github.com.json index 19bc5f997a..4000cd220b 100644 --- a/lib/rest/static/decorated/api.github.com.json +++ b/lib/rest/static/decorated/api.github.com.json @@ -30881,7 +30881,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Lists the codespaces associated to a specified repository and the authenticated user.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Lists the codespaces associated to a specified repository and the authenticated user.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have read access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -31031,7 +31031,7 @@ "slug": "create-a-codespace-in-a-repository", "category": "codespaces", "notes": [], - "descriptionHTML": "

Creates a codespace owned by the authenticated user in the specified repository.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Creates a codespace owned by the authenticated user in the specified repository.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "201", @@ -31238,7 +31238,7 @@ "slug": "create-a-codespace-from-a-pull-request", "category": "codespaces", "notes": [], - "descriptionHTML": "

Creates a codespace owned by the authenticated user for the specified pull request.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Creates a codespace owned by the authenticated user for the specified pull request.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "201", @@ -31371,7 +31371,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Lists the authenticated user's codespaces.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Lists the authenticated user's codespaces.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have read access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -31683,7 +31683,7 @@ "slug": "create-a-codespace-for-the-authenticated-user", "category": "codespaces", "notes": [], - "descriptionHTML": "

Creates a new codespace, owned by the authenticated user.

\n

This endpoint requires either a repository_id OR a pull_request but not both.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Creates a new codespace, owned by the authenticated user.

\n

This endpoint requires either a repository_id OR a pull_request but not both.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "201", @@ -31874,7 +31874,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Gets information about a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Gets information about a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have read access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -31993,7 +31993,7 @@ "slug": "update-a-codespace-for-the-authenticated-user", "category": "codespaces", "notes": [], - "descriptionHTML": "

Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.

\n

If you specify a new machine type it will be applied the next time your codespace is started.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.

\n

If you specify a new machine type it will be applied the next time your codespace is started.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32086,7 +32086,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Deletes a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Deletes a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "202", @@ -32156,7 +32156,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.

\n

You must authenticate using a personal access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.

\n

You must authenticate using a personal access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "202", @@ -32237,7 +32237,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Gets information about an export of a codespace.

\n

You must authenticate using a personal access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Gets information about an export of a codespace.

\n

You must authenticate using a personal access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_lifecycle_admin repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32288,7 +32288,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Starts a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Starts a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32374,7 +32374,7 @@ "category": "codespaces", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Stops a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

Stops a user's codespace.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32454,7 +32454,7 @@ ], "summary": "List available machine types for a repository", "x-github": { - "enabledForGitHubApps": false, + "enabledForGitHubApps": true, "category": "codespaces", "subcategory": "machines" }, @@ -32463,7 +32463,7 @@ "subcategory": "machines", "notes": [], "bodyParameters": [], - "descriptionHTML": "

List the machine types available for a given repository based on its configuration.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

List the machine types available for a given repository based on its configuration.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_metadata repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32534,7 +32534,7 @@ "subcategory": "machines", "notes": [], "bodyParameters": [], - "descriptionHTML": "

List the machine types a codespace can transition to use.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

", + "descriptionHTML": "

List the machine types a codespace can transition to use.

\n

You must authenticate using an access token with the codespace scope to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_metadata repository permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32570,6 +32570,386 @@ ] } ], + "repository-secrets": [ + { + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "per_page", + "description": "Results per page (max 100)", + "in": "query", + "schema": { + "type": "integer", + "default": 30 + }, + "descriptionHTML": "

Results per page (max 100)

" + }, + { + "name": "page", + "description": "Page number of the results to fetch.", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + }, + "descriptionHTML": "

Page number of the results to fetch.

" + } + ], + "x-codeSamples": [ + { + "lang": "Shell", + "source": "curl \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/octocat/hello-world/codespaces/secrets" + }, + { + "lang": "JavaScript", + "source": "await octokit.request('GET /repos/{owner}/{repo}/codespaces/secrets', {\n owner: 'octocat',\n repo: 'hello-world'\n})" + } + ], + "summary": "List repository secrets", + "x-github": { + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + }, + "slug": "list-repository-secrets", + "category": "codespaces", + "subcategory": "repository-secrets", + "notes": [], + "bodyParameters": [], + "descriptionHTML": "

Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the secrets repository permission to use this endpoint.

", + "responses": [ + { + "httpStatusCode": "200", + "httpStatusMessage": "OK", + "description": "

Response

", + "payload": "{\n \"total_count\": 2,\n \"secrets\": [\n {\n \"name\": \"GH_TOKEN\",\n \"created_at\": \"2019-08-10T14:59:22Z\",\n \"updated_at\": \"2020-01-10T14:59:22Z\"\n },\n {\n \"name\": \"GIST_ID\",\n \"created_at\": \"2020-01-10T10:59:22Z\",\n \"updated_at\": \"2020-01-11T11:59:22Z\"\n }\n ]\n}" + } + ] + }, + { + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/public-key", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + } + ], + "x-codeSamples": [ + { + "lang": "Shell", + "source": "curl \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/octocat/hello-world/codespaces/secrets/public-key" + }, + { + "lang": "JavaScript", + "source": "await octokit.request('GET /repos/{owner}/{repo}/codespaces/secrets/public-key', {\n owner: 'octocat',\n repo: 'hello-world'\n})" + } + ], + "summary": "Get a repository public key", + "x-github": { + "enabledForGitHubApps": false, + "category": "codespaces", + "subcategory": "repository-secrets" + }, + "slug": "get-a-repository-public-key", + "category": "codespaces", + "subcategory": "repository-secrets", + "notes": [], + "bodyParameters": [], + "descriptionHTML": "

Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the secrets repository permission to use this endpoint.

", + "responses": [ + { + "httpStatusCode": "200", + "httpStatusMessage": "OK", + "description": "

Response

", + "payload": "{\n \"key_id\": \"012345678912345678\",\n \"key\": \"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234\"\n}" + } + ] + }, + { + "verb": "get", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "

secret_name parameter

" + } + ], + "x-codeSamples": [ + { + "lang": "Shell", + "source": "curl \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/octocat/hello-world/codespaces/secrets/SECRET_NAME" + }, + { + "lang": "JavaScript", + "source": "await octokit.request('GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}', {\n owner: 'octocat',\n repo: 'hello-world',\n secret_name: 'secret_name'\n})" + } + ], + "summary": "Get a repository secret", + "x-github": { + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + }, + "slug": "get-a-repository-secret", + "category": "codespaces", + "subcategory": "repository-secrets", + "notes": [], + "bodyParameters": [], + "descriptionHTML": "

Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the codespaces_secrets repository permission to use this endpoint.

", + "responses": [ + { + "httpStatusCode": "200", + "httpStatusMessage": "OK", + "description": "

Response

", + "payload": "{\n \"name\": \"GH_TOKEN\",\n \"created_at\": \"2019-08-10T14:59:22Z\",\n \"updated_at\": \"2020-01-10T14:59:22Z\"\n}" + } + ] + }, + { + "verb": "put", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "

secret_name parameter

" + } + ], + "x-codeSamples": [ + { + "lang": "Shell", + "source": "curl \\\n -X PUT \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/octocat/hello-world/codespaces/secrets/SECRET_NAME \\\n -d '{\"encrypted_value\":\"encrypted_value\"}'" + }, + { + "lang": "JavaScript", + "source": "await octokit.request('PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}', {\n owner: 'octocat',\n repo: 'hello-world',\n secret_name: 'secret_name',\n encrypted_value: 'encrypted_value'\n})" + } + ], + "summary": "Create or update a repository secret", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "encrypted_value": { + "type": "string", + "description": "

Value for your secret, encrypted with LibSodium using the public key retrieved from the Get a repository public key endpoint.

", + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + "name": "encrypted_value", + "in": "body", + "rawType": "string", + "rawDescription": "Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/codespaces#get-a-repository-public-key) endpoint.", + "childParamsGroups": [] + }, + "key_id": { + "type": "string", + "description": "

ID of the key you used to encrypt the secret.

", + "name": "key_id", + "in": "body", + "rawType": "string", + "rawDescription": "ID of the key you used to encrypt the secret.", + "childParamsGroups": [] + } + } + }, + "example": { + "encrypted_value": "c2VjcmV0", + "key_id": "012345678912345678" + } + } + } + }, + "x-github": { + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + }, + "slug": "create-or-update-a-repository-secret", + "category": "codespaces", + "subcategory": "repository-secrets", + "notes": [], + "responses": [ + { + "httpStatusCode": "201", + "httpStatusMessage": "Created", + "description": "

Response when creating a secret

" + }, + { + "httpStatusCode": "204", + "httpStatusMessage": "No Content", + "description": "

Response when updating a secret

" + } + ], + "descriptionHTML": "

Creates or updates a repository secret with an encrypted value. Encrypt your secret using\nLibSodium. You must authenticate using an access\ntoken with the repo scope to use this endpoint. GitHub Apps must have the codespaces_secrets repository\npermission to use this endpoint.

\n

Example of encrypting a secret using Node.js

\n

Encrypt your secret using the tweetsodium library.

\n
const sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n
\n

Example of encrypting a secret using Python

\n

Encrypt your secret using pynacl with Python 3.

\n
from base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n  \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n  public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n  sealed_box = public.SealedBox(public_key)\n  encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n  return b64encode(encrypted).decode(\"utf-8\")\n
\n

Example of encrypting a secret using C#

\n

Encrypt your secret using the Sodium.Core package.

\n
var secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n
\n

Example of encrypting a secret using Ruby

\n

Encrypt your secret using the rbnacl gem.

\n
require \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n
", + "bodyParameters": [ + { + "type": "string", + "description": "

Value for your secret, encrypted with LibSodium using the public key retrieved from the Get a repository public key endpoint.

", + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + "name": "encrypted_value", + "in": "body", + "rawType": "string", + "rawDescription": "Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/codespaces#get-a-repository-public-key) endpoint.", + "childParamsGroups": [] + }, + { + "type": "string", + "description": "

ID of the key you used to encrypt the secret.

", + "name": "key_id", + "in": "body", + "rawType": "string", + "rawDescription": "ID of the key you used to encrypt the secret.", + "childParamsGroups": [] + } + ] + }, + { + "verb": "delete", + "requestPath": "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "" + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "descriptionHTML": "

secret_name parameter

" + } + ], + "x-codeSamples": [ + { + "lang": "Shell", + "source": "curl \\\n -X DELETE \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/octocat/hello-world/codespaces/secrets/SECRET_NAME" + }, + { + "lang": "JavaScript", + "source": "await octokit.request('DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}', {\n owner: 'octocat',\n repo: 'hello-world',\n secret_name: 'secret_name'\n})" + } + ], + "summary": "Delete a repository secret", + "x-github": { + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + }, + "slug": "delete-a-repository-secret", + "category": "codespaces", + "subcategory": "repository-secrets", + "notes": [], + "bodyParameters": [], + "descriptionHTML": "

Deletes a secret in a repository using the secret name. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the codespaces_secrets repository permission to use this endpoint.

", + "responses": [ + { + "httpStatusCode": "204", + "httpStatusMessage": "No Content", + "description": "

Response

" + } + ] + } + ], "secrets": [ { "verb": "get", @@ -32617,7 +32997,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Lists all secrets available for a user's Codespaces without revealing their\nencrypted values.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Lists all secrets available for a user's Codespaces without revealing their\nencrypted values.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32652,7 +33032,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with one of the 'read:user' or 'user' scopes in their personal access token. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32698,7 +33078,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Gets a secret available to a user's codespaces without revealing its encrypted value.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Gets a secret available to a user's codespaces without revealing its encrypted value.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -32819,7 +33199,7 @@ "description": "

Validation failed

" } ], - "descriptionHTML": "

Creates or updates a secret for a user's codespace with an encrypted value. Encrypt your secret using\nLibSodium. You must authenticate using an access token with the user scope to use this endpoint. User must also have Codespaces access to use this endpoint.

\n

Example encrypting a secret using Node.js

\n

Encrypt your secret using the tweetsodium library.

\n
const sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n
\n

Example encrypting a secret using Python

\n

Encrypt your secret using pynacl with Python 3.

\n
from base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n  \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n  public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n  sealed_box = public.SealedBox(public_key)\n  encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n  return b64encode(encrypted).decode(\"utf-8\")\n
\n

Example encrypting a secret using C#

\n

Encrypt your secret using the Sodium.Core package.

\n
var secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n
\n

Example encrypting a secret using Ruby

\n

Encrypt your secret using the rbnacl gem.

\n
require \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n
", + "descriptionHTML": "

Creates or updates a secret for a user's codespace with an encrypted value. Encrypt your secret using\nLibSodium.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must also have Codespaces access to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_user_secrets user permission and codespace_secrets repository permission on all referenced repositories to use this endpoint.

\n

Example encrypting a secret using Node.js

\n

Encrypt your secret using the tweetsodium library.

\n
const sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n
\n

Example encrypting a secret using Python

\n

Encrypt your secret using pynacl with Python 3.

\n
from base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n  \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n  public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n  sealed_box = public.SealedBox(public_key)\n  encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n  return b64encode(encrypted).decode(\"utf-8\")\n
\n

Example encrypting a secret using C#

\n

Encrypt your secret using the Sodium.Core package.

\n
var secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n
\n

Example encrypting a secret using Ruby

\n

Encrypt your secret using the rbnacl gem.

\n
require \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n
", "bodyParameters": [ { "type": "string", @@ -32890,7 +33270,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Deletes a secret from a user's codespaces using the secret name. Deleting the secret will remove access from all codespaces that were allowed to access the secret. You must authenticate using an access token with the user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Deletes a secret from a user's codespaces using the secret name. Deleting the secret will remove access from all codespaces that were allowed to access the secret.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint.

", "responses": [ { "httpStatusCode": "204", @@ -32935,7 +33315,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

List the repositories that have been granted the ability to use a user's codespace secret.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

List the repositories that have been granted the ability to use a user's codespace secret.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have read access to the codespaces_user_secrets user permission and write access to the codespace_secrets repository permission on all referenced repositories to use this endpoint.

", "responses": [ { "httpStatusCode": "200", @@ -33033,7 +33413,7 @@ "category": "codespaces", "subcategory": "secrets", "notes": [], - "descriptionHTML": "

Select the repositories that will use a user's codespace secret.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Select the repositories that will use a user's codespace secret.

\n

You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.

\n

GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespace_secrets repository permission on all referenced repositories to use this endpoint.

", "responses": [ { "httpStatusCode": "204", @@ -33121,7 +33501,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Adds a repository to the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Adds a repository to the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.\nGitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespace_secrets repository permission on the referenced repository to use this endpoint.

", "responses": [ { "httpStatusCode": "204", @@ -33195,7 +33575,7 @@ "subcategory": "secrets", "notes": [], "bodyParameters": [], - "descriptionHTML": "

Removes a repository from the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the user or read:user scope to use this endpoint. User must have Codespaces access to use this endpoint.

", + "descriptionHTML": "

Removes a repository from the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint.\nGitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint.

", "responses": [ { "httpStatusCode": "204", diff --git a/lib/rest/static/dereferenced/api.github.com.deref.json b/lib/rest/static/dereferenced/api.github.com.deref.json index 312142e442..0e3667fa6c 100644 --- a/lib/rest/static/dereferenced/api.github.com.deref.json +++ b/lib/rest/static/dereferenced/api.github.com.deref.json @@ -232795,7 +232795,7 @@ "/repos/{owner}/{repo}/codespaces": { "get": { "summary": "List codespaces in a repository for the authenticated user", - "description": "Lists the codespaces associated to a specified repository and the authenticated user.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Lists the codespaces associated to a specified repository and the authenticated user.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -236022,7 +236022,7 @@ }, "post": { "summary": "Create a codespace in a repository", - "description": "Creates a codespace owned by the authenticated user in the specified repository.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Creates a codespace owned by the authenticated user in the specified repository.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -241993,7 +241993,7 @@ "/repos/{owner}/{repo}/codespaces/machines": { "get": { "summary": "List available machine types for a repository", - "description": "List the machine types available for a given repository based on its configuration.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "List the machine types available for a given repository based on its configuration.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_metadata` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -242263,12 +242263,480 @@ }, "x-github": { "githubCloudOnly": false, - "enabledForGitHubApps": false, + "enabledForGitHubApps": true, "category": "codespaces", "subcategory": "machines" } } }, + "/repos/{owner}/{repo}/codespaces/secrets": { + "get": { + "summary": "List repository secrets", + "description": "Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint.", + "tags": [ + "codespaces" + ], + "operationId": "codespaces/list-repo-secrets", + "externalDocs": { + "description": "API method documentation", + "url": "https://docs.github.com/rest/reference/codespaces#list-repository-secrets" + }, + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "per_page", + "description": "Results per page (max 100)", + "in": "query", + "schema": { + "type": "integer", + "default": 30 + } + }, + { + "name": "page", + "description": "Page number of the results to fetch.", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + } + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total_count", + "secrets" + ], + "properties": { + "total_count": { + "type": "integer" + }, + "secrets": { + "type": "array", + "items": { + "title": "Codespaces Secret", + "description": "Set repository secrets for GitHub Codespaces.", + "type": "object", + "properties": { + "name": { + "description": "The name of the secret.", + "type": "string", + "examples": [ + "SECRET_TOKEN" + ] + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "name", + "created_at", + "updated_at" + ] + } + } + } + }, + "examples": { + "default": { + "value": { + "total_count": 2, + "secrets": [ + { + "name": "GH_TOKEN", + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2020-01-10T14:59:22Z" + }, + { + "name": "GIST_ID", + "created_at": "2020-01-10T10:59:22Z", + "updated_at": "2020-01-11T11:59:22Z" + } + ] + } + } + } + } + }, + "headers": { + "Link": { + "example": "; rel=\"next\", ; rel=\"last\"", + "schema": { + "type": "string" + } + } + } + } + }, + "x-github": { + "githubCloudOnly": false, + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + } + } + }, + "/repos/{owner}/{repo}/codespaces/secrets/public-key": { + "get": { + "summary": "Get a repository public key", + "description": "Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `secrets` repository permission to use this endpoint.", + "tags": [ + "codespaces" + ], + "operationId": "codespaces/get-repo-public-key", + "externalDocs": { + "description": "API method documentation", + "url": "https://docs.github.com/rest/reference/codespaces#get-a-repository-public-key" + }, + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "title": "CodespacesPublicKey", + "description": "The public key used for setting Codespaces secrets.", + "type": "object", + "properties": { + "key_id": { + "description": "The identifier for the key.", + "type": "string", + "examples": [ + "1234567" + ] + }, + "key": { + "description": "The Base64 encoded public key.", + "type": "string", + "examples": [ + "hBT5WZEj8ZoOv6TYJsfWq7MxTEQopZO5/IT3ZCVQPzs=" + ] + }, + "id": { + "type": "integer", + "examples": [ + 2 + ] + }, + "url": { + "type": "string", + "examples": [ + "https://api.github.com/user/keys/2" + ] + }, + "title": { + "type": "string", + "examples": [ + "ssh-rsa AAAAB3NzaC1yc2EAAA" + ] + }, + "created_at": { + "type": "string", + "examples": [ + "2011-01-26T19:01:12Z" + ] + } + }, + "required": [ + "key_id", + "key" + ] + }, + "examples": { + "default": { + "value": { + "key_id": "012345678912345678", + "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234" + } + } + } + } + } + } + }, + "x-github": { + "githubCloudOnly": false, + "enabledForGitHubApps": false, + "category": "codespaces", + "subcategory": "repository-secrets" + } + } + }, + "/repos/{owner}/{repo}/codespaces/secrets/{secret_name}": { + "get": { + "summary": "Get a repository secret", + "description": "Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `codespaces_secrets` repository permission to use this endpoint.", + "tags": [ + "codespaces" + ], + "operationId": "codespaces/get-repo-secret", + "externalDocs": { + "description": "API method documentation", + "url": "https://docs.github.com/rest/reference/codespaces#get-a-repository-secret" + }, + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "title": "Codespaces Secret", + "description": "Set repository secrets for GitHub Codespaces.", + "type": "object", + "properties": { + "name": { + "description": "The name of the secret.", + "type": "string", + "examples": [ + "SECRET_TOKEN" + ] + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "name", + "created_at", + "updated_at" + ] + }, + "examples": { + "default": { + "value": { + "name": "GH_TOKEN", + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2020-01-10T14:59:22Z" + } + } + } + } + } + } + }, + "x-github": { + "githubCloudOnly": false, + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + } + }, + "put": { + "summary": "Create or update a repository secret", + "description": "Creates or updates a repository secret with an encrypted value. Encrypt your secret using\n[LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access\ntoken with the `repo` scope to use this endpoint. GitHub Apps must have the `codespaces_secrets` repository\npermission to use this endpoint.\n\n#### Example of encrypting a secret using Node.js\n\nEncrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.\n\n```\nconst sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n```\n\n\n#### Example of encrypting a secret using Python\n\nEncrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/latest/public/#nacl-public-sealedbox) with Python 3.\n\n```\nfrom base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n sealed_box = public.SealedBox(public_key)\n encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n return b64encode(encrypted).decode(\"utf-8\")\n```\n\n#### Example of encrypting a secret using C#\n\nEncrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.\n\n```\nvar secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n```\n\n#### Example of encrypting a secret using Ruby\n\nEncrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.\n\n```ruby\nrequire \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n```", + "tags": [ + "codespaces" + ], + "operationId": "codespaces/create-or-update-repo-secret", + "externalDocs": { + "description": "API method documentation", + "url": "https://docs.github.com/rest/reference/codespaces#create-or-update-a-repository-secret" + }, + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "encrypted_value": { + "type": "string", + "description": "Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/codespaces#get-a-repository-public-key) endpoint.", + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$" + }, + "key_id": { + "type": "string", + "description": "ID of the key you used to encrypt the secret." + } + } + }, + "example": { + "encrypted_value": "c2VjcmV0", + "key_id": "012345678912345678" + } + } + } + }, + "responses": { + "201": { + "description": "Response when creating a secret", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + }, + "additionalProperties": false + } + } + } + }, + "204": { + "description": "Response when updating a secret" + } + }, + "x-github": { + "githubCloudOnly": false, + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + } + }, + "delete": { + "summary": "Delete a repository secret", + "description": "Deletes a secret in a repository using the secret name. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `codespaces_secrets` repository permission to use this endpoint.", + "tags": [ + "codespaces" + ], + "operationId": "codespaces/delete-repo-secret", + "externalDocs": { + "description": "API method documentation", + "url": "https://docs.github.com/rest/reference/codespaces#delete-a-repository-secret" + }, + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secret_name", + "description": "secret_name parameter", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Response" + } + }, + "x-github": { + "githubCloudOnly": false, + "enabledForGitHubApps": true, + "category": "codespaces", + "subcategory": "repository-secrets" + } + } + }, "/repos/{owner}/{repo}/collaborators": { "get": { "summary": "List repository collaborators", @@ -400171,7 +400639,7 @@ "/repos/{owner}/{repo}/pulls/{pull_number}/codespaces": { "post": { "summary": "Create a codespace from a pull request", - "description": "Creates a codespace owned by the authenticated user for the specified pull request.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Creates a codespace owned by the authenticated user for the specified pull request.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -479786,7 +480254,7 @@ "/user/codespaces": { "get": { "summary": "List codespaces for the authenticated user", - "description": "Lists the authenticated user's codespaces.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Lists the authenticated user's codespaces.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -483153,7 +483621,7 @@ }, "post": { "summary": "Create a codespace for the authenticated user", - "description": "Creates a new codespace, owned by the authenticated user.\n\nThis endpoint requires either a `repository_id` OR a `pull_request` but not both.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Creates a new codespace, owned by the authenticated user.\n\nThis endpoint requires either a `repository_id` OR a `pull_request` but not both.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -489157,7 +489625,7 @@ "/user/codespaces/secrets": { "get": { "summary": "List secrets for the authenticated user", - "description": "Lists all secrets available for a user's Codespaces without revealing their\nencrypted values.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Lists all secrets available for a user's Codespaces without revealing their\nencrypted values.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_user_secrets` user permission to use this endpoint.", "tags": [ "codespaces" ], @@ -489524,7 +489992,7 @@ "/user/codespaces/secrets/public-key": { "get": { "summary": "Get public key for the authenticated user", - "description": "Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with one of the 'read:user' or 'user' scopes in their personal access token. User must have Codespaces access to use this endpoint.", + "description": "Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_user_secrets` user permission to use this endpoint.", "tags": [ "codespaces" ], @@ -489586,7 +490054,7 @@ "/user/codespaces/secrets/{secret_name}": { "get": { "summary": "Get a secret for the authenticated user", - "description": "Gets a secret available to a user's codespaces without revealing its encrypted value.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Gets a secret available to a user's codespaces without revealing its encrypted value.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_user_secrets` user permission to use this endpoint.", "tags": [ "codespaces" ], @@ -489680,7 +490148,7 @@ }, "put": { "summary": "Create or update a secret for the authenticated user", - "description": "Creates or updates a secret for a user's codespace with an encrypted value. Encrypt your secret using\n[LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the `user` scope to use this endpoint. User must also have Codespaces access to use this endpoint.\n\n#### Example encrypting a secret using Node.js\n\nEncrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.\n\n```\nconst sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n```\n\n\n#### Example encrypting a secret using Python\n\nEncrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/latest/public/#nacl-public-sealedbox) with Python 3.\n\n```\nfrom base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n sealed_box = public.SealedBox(public_key)\n encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n return b64encode(encrypted).decode(\"utf-8\")\n```\n\n#### Example encrypting a secret using C#\n\nEncrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.\n\n```\nvar secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n```\n\n#### Example encrypting a secret using Ruby\n\nEncrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.\n\n```ruby\nrequire \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n```", + "description": "Creates or updates a secret for a user's codespace with an encrypted value. Encrypt your secret using\n[LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages).\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must also have Codespaces access to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_user_secrets` user permission and `codespace_secrets` repository permission on all referenced repositories to use this endpoint.\n\n#### Example encrypting a secret using Node.js\n\nEncrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.\n\n```\nconst sodium = require('tweetsodium');\n\nconst key = \"base64-encoded-public-key\";\nconst value = \"plain-text-secret\";\n\n// Convert the message and key to Uint8Array's (Buffer implements that interface)\nconst messageBytes = Buffer.from(value);\nconst keyBytes = Buffer.from(key, 'base64');\n\n// Encrypt using LibSodium.\nconst encryptedBytes = sodium.seal(messageBytes, keyBytes);\n\n// Base64 the encrypted secret\nconst encrypted = Buffer.from(encryptedBytes).toString('base64');\n\nconsole.log(encrypted);\n```\n\n\n#### Example encrypting a secret using Python\n\nEncrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/latest/public/#nacl-public-sealedbox) with Python 3.\n\n```\nfrom base64 import b64encode\nfrom nacl import encoding, public\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n sealed_box = public.SealedBox(public_key)\n encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n return b64encode(encrypted).decode(\"utf-8\")\n```\n\n#### Example encrypting a secret using C#\n\nEncrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.\n\n```\nvar secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\");\nvar publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");\n\nvar sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);\n\nConsole.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));\n```\n\n#### Example encrypting a secret using Ruby\n\nEncrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.\n\n```ruby\nrequire \"rbnacl\"\nrequire \"base64\"\n\nkey = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\")\npublic_key = RbNaCl::PublicKey.new(key)\n\nbox = RbNaCl::Boxes::Sealed.from_public_key(public_key)\nencrypted_secret = box.encrypt(\"my_secret\")\n\n# Print the base64 encoded secret\nputs Base64.strict_encode64(encrypted_secret)\n```", "tags": [ "codespaces" ], @@ -489867,7 +490335,7 @@ }, "delete": { "summary": "Delete a secret for the authenticated user", - "description": "Deletes a secret from a user's codespaces using the secret name. Deleting the secret will remove access from all codespaces that were allowed to access the secret. You must authenticate using an access token with the `user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Deletes a secret from a user's codespaces using the secret name. Deleting the secret will remove access from all codespaces that were allowed to access the secret.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_user_secrets` user permission to use this endpoint.", "tags": [ "codespaces" ], @@ -489903,7 +490371,7 @@ "/user/codespaces/secrets/{secret_name}/repositories": { "get": { "summary": "List selected repositories for a user secret", - "description": "List the repositories that have been granted the ability to use a user's codespace secret.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "List the repositories that have been granted the ability to use a user's codespace secret.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_user_secrets` user permission and write access to the `codespace_secrets` repository permission on all referenced repositories to use this endpoint.", "tags": [ "codespaces" ], @@ -492419,7 +492887,7 @@ }, "put": { "summary": "Set selected repositories for a user secret", - "description": "Select the repositories that will use a user's codespace secret.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Select the repositories that will use a user's codespace secret.\n\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_user_secrets` user permission and write access to the `codespace_secrets` repository permission on all referenced repositories to use this endpoint.", "tags": [ "codespaces" ], @@ -492587,7 +493055,7 @@ "/user/codespaces/secrets/{secret_name}/repositories/{repository_id}": { "put": { "summary": "Add a selected repository to a user secret", - "description": "Adds a repository to the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Adds a repository to the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\nGitHub Apps must have write access to the `codespaces_user_secrets` user permission and write access to the `codespace_secrets` repository permission on the referenced repository to use this endpoint.", "tags": [ "codespaces" ], @@ -492733,7 +493201,7 @@ }, "delete": { "summary": "Remove a selected repository from a user secret", - "description": "Removes a repository from the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the `user` or `read:user` scope to use this endpoint. User must have Codespaces access to use this endpoint.", + "description": "Removes a repository from the selected repositories for a user's codespace secret.\nYou must authenticate using an access token with the `codespace` or `codespace:secrets` scope to use this endpoint. User must have Codespaces access to use this endpoint.\nGitHub Apps must have write access to the `codespaces_user_secrets` user permission to use this endpoint.", "tags": [ "codespaces" ], @@ -492881,7 +493349,7 @@ "/user/codespaces/{codespace_name}": { "get": { "summary": "Get a codespace for the authenticated user", - "description": "Gets information about a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Gets information about a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -495922,7 +496390,7 @@ }, "patch": { "summary": "Update a codespace for the authenticated user", - "description": "Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.\n\nIf you specify a new machine type it will be applied the next time your codespace is started.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.\n\nIf you specify a new machine type it will be applied the next time your codespace is started.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -498968,7 +499436,7 @@ }, "delete": { "summary": "Delete a codespace for the authenticated user", - "description": "Deletes a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Deletes a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -499118,7 +499586,7 @@ "/user/codespaces/{codespace_name}/exports": { "post": { "summary": "Export a codespace for the authenticated user", - "description": "Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.\n\nYou must authenticate using a personal access token with the `codespace` scope to use this endpoint.", + "description": "Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.\n\nYou must authenticate using a personal access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_lifecycle_admin` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -499417,7 +499885,7 @@ "/user/codespaces/{codespace_name}/exports/{export_id}": { "get": { "summary": "Get details about a codespace export", - "description": "Gets information about an export of a codespace.\n\nYou must authenticate using a personal access token with the `codespace` scope to use this endpoint.", + "description": "Gets information about an export of a codespace.\n\nYou must authenticate using a personal access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_lifecycle_admin` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -499572,7 +500040,7 @@ "/user/codespaces/{codespace_name}/machines": { "get": { "summary": "List machine types for a codespace", - "description": "List the machine types a codespace can transition to use.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "List the machine types a codespace can transition to use.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have read access to the `codespaces_metadata` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -499833,7 +500301,7 @@ "/user/codespaces/{codespace_name}/start": { "post": { "summary": "Start a codespace for the authenticated user", - "description": "Starts a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Starts a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_lifecycle_admin` repository permission to use this endpoint.", "tags": [ "codespaces" ], @@ -502996,7 +503464,7 @@ "/user/codespaces/{codespace_name}/stop": { "post": { "summary": "Stop a codespace for the authenticated user", - "description": "Stops a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.", + "description": "Stops a user's codespace.\n\nYou must authenticate using an access token with the `codespace` scope to use this endpoint.\n\nGitHub Apps must have write access to the `codespaces_lifecycle_admin` repository permission to use this endpoint.", "tags": [ "codespaces" ],