View Source GitHub.Codespaces (GitHub REST API Client v0.2.2)
Provides API endpoints related to codespaces
Link to this section Summary
Functions
Add a selected repository to a user secret
Add selected repository to an organization secret
List machine types for a codespace
Create a codespace for the authenticated user
Create or update an organization secret
Create or update a repository secret
Create or update a secret for the authenticated user
Create a codespace from a pull request
Create a codespace in a repository
Remove users from Codespaces access for an organization
Delete a codespace for the authenticated user
Delete a codespace from the organization
Delete an organization secret
Delete a repository secret
Delete a secret for the authenticated user
Export a codespace for the authenticated user
List codespaces for a user in organization
Get details about a codespace export
Get a codespace for the authenticated user
Get an organization public key
Get an organization secret
Get public key for the authenticated user
Get a repository public key
Get a repository secret
Get a secret for the authenticated user
List devcontainer configurations in a repository for the authenticated user
List codespaces for the authenticated user
List codespaces for the organization
List codespaces in a repository for the authenticated user
List organization secrets
List repository secrets
List selected repositories for a user secret
List secrets for the authenticated user
List selected repositories for an organization secret
Get default attributes for a codespace
Create a repository from an unpublished codespace
Remove a selected repository from a user secret
Remove selected repository from an organization secret
List available machine types for a repository
Manage access control for organization codespaces
Add users to Codespaces access for an organization
Set selected repositories for a user secret
Set selected repositories for an organization secret
Start a codespace for the authenticated user
Stop a codespace for the authenticated user
Stop a codespace for an organization user
Update a codespace for the authenticated user
Link to this section Functions
add_repository_for_secret_for_authenticated_user(secret_name, repository_id, opts \\ [])
View Source@spec add_repository_for_secret_for_authenticated_user( String.t(), integer(), keyword() ) :: :ok | {:error, GitHub.Error.t()}
Add a selected repository to a user secret
Adds a repository to the selected repositories for a user's codespace secret.
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.
GitHub Apps must have write access to the codespaces_user_secrets
user permission and write access to the codespaces_secrets
repository permission on the referenced repository to use this endpoint.
resources
Resources
add_selected_repo_to_org_secret(org, secret_name, repository_id, opts \\ [])
View Source@spec add_selected_repo_to_org_secret(String.t(), String.t(), integer(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Add selected repository to an organization secret
Adds a repository to an organization secret when the visibility
for repository access is set to selected
. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
codespace_machines_for_authenticated_user(codespace_name, opts \\ [])
View Source@spec codespace_machines_for_authenticated_user( String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
List machine types for a codespace
List the machine types a codespace can transition to use.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces_metadata
repository permission to use this endpoint.
resources
Resources
@spec create_for_authenticated_user( map(), keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Create a codespace for the authenticated user
Creates a new codespace, owned by the authenticated user.
This endpoint requires either a repository_id
OR a pull_request
but not both.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
resources
Resources
@spec create_or_update_org_secret(String.t(), String.t(), map(), keyword()) :: {:ok, GitHub.EmptyObject.t()} | {:error, GitHub.Error.t()}
Create or update an organization secret
Creates or updates an organization secret with an encrypted value. Encrypt your secret using LibSodium. For more information, see "Encrypting secrets for the REST API."
You must authenticate using an access
token with the admin:org
scope to use this endpoint.
resources
Resources
create_or_update_repo_secret(owner, repo, secret_name, body, opts \\ [])
View Source@spec create_or_update_repo_secret( String.t(), String.t(), String.t(), map(), keyword() ) :: {:ok, GitHub.EmptyObject.t()} | {:error, GitHub.Error.t()}
Create or update a repository secret
Creates or updates a repository secret with an encrypted value. Encrypt your secret using LibSodium. For more information, see "Encrypting secrets for the REST API."
You must authenticate using an access
token with the repo
scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets
repository permission to use this endpoint.
resources
Resources
create_or_update_secret_for_authenticated_user(secret_name, body, opts \\ [])
View Source@spec create_or_update_secret_for_authenticated_user(String.t(), map(), keyword()) :: {:ok, GitHub.EmptyObject.t()} | {:error, GitHub.Error.t()}
Create or update a secret for the authenticated user
Creates or updates a secret for a user's codespace with an encrypted value. Encrypt your secret using LibSodium. For more information, see "Encrypting secrets for the REST API."
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.
GitHub Apps must have write access to the codespaces_user_secrets
user permission and codespaces_secrets
repository permission on all referenced repositories to use this endpoint.
resources
Resources
create_with_pr_for_authenticated_user(owner, repo, pull_number, body, opts \\ [])
View Source@spec create_with_pr_for_authenticated_user( String.t(), String.t(), integer(), map() | nil, keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Create a codespace from a pull request
Creates a codespace owned by the authenticated user for the specified pull request.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
resources
Resources
create_with_repo_for_authenticated_user(owner, repo, body, opts \\ [])
View Source@spec create_with_repo_for_authenticated_user( String.t(), String.t(), map() | nil, keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Create a codespace in a repository
Creates a codespace owned by the authenticated user in the specified repository.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
resources
Resources
@spec delete_codespaces_access_users(String.t(), map(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Remove users from Codespaces access for an organization
Codespaces for the specified users will no longer be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members
.
For information on how to change this setting, see "Manage access control for organization codespaces."
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec delete_for_authenticated_user( String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
Delete a codespace for the authenticated user
Deletes a user's codespace.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
resources
Resources
delete_from_organization(org, username, codespace_name, opts \\ [])
View Source@spec delete_from_organization(String.t(), String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
Delete a codespace from the organization
Deletes a user's codespace.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec delete_org_secret(String.t(), String.t(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Delete an organization secret
Deletes an organization secret using the secret name. You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec delete_repo_secret(String.t(), String.t(), String.t(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Delete a repository secret
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 write access to the codespaces_secrets
repository permission to use this endpoint.
resources
Resources
@spec delete_secret_for_authenticated_user( String.t(), keyword() ) :: :ok | {:error, GitHub.Error.t()}
Delete a secret for the authenticated user
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 codespace
or codespace:secrets
scope to use this endpoint. User must have Codespaces access to use this endpoint.
GitHub Apps must have write access to the codespaces_user_secrets
user permission to use this endpoint.
resources
Resources
@spec export_for_authenticated_user( String.t(), keyword() ) :: {:ok, GitHub.Codespace.ExportDetails.t()} | {:error, GitHub.Error.t()}
Export a codespace for the authenticated user
Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.
If changes cannot be pushed to the codespace's repository, they will be pushed to a new or previously-existing fork instead.
You must authenticate using a personal access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces_lifecycle_admin
repository permission to use this endpoint.
resources
Resources
@spec get_codespaces_for_user_in_org(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List codespaces for a user in organization
Lists the codespaces that a member of an organization has for repositories in that organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
get_export_details_for_authenticated_user(codespace_name, export_id, opts \\ [])
View Source@spec get_export_details_for_authenticated_user(String.t(), String.t(), keyword()) :: {:ok, GitHub.Codespace.ExportDetails.t()} | {:error, GitHub.Error.t()}
Get details about a codespace export
Gets information about an export of a codespace.
You must authenticate using a personal access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces_lifecycle_admin
repository permission to use this endpoint.
resources
Resources
@spec get_for_authenticated_user( String.t(), keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Get a codespace for the authenticated user
Gets information about a user's codespace.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces
repository permission to use this endpoint.
resources
Resources
@spec get_org_public_key( String.t(), keyword() ) :: {:ok, GitHub.Codespace.PublicKey.t()} | {:error, GitHub.Error.t()}
Get an organization public key
Gets a public key for an organization, which is required in order to encrypt secrets. You need to encrypt the value of a secret before you can create or update secrets. You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec get_org_secret(String.t(), String.t(), keyword()) :: {:ok, GitHub.Codespace.OrgSecret.t()} | {:error, GitHub.Error.t()}
Get an organization secret
Gets an organization secret without revealing its encrypted value.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec get_public_key_for_authenticated_user(keyword()) :: {:ok, GitHub.Codespace.UserPublicKey.t()} | {:error, GitHub.Error.t()}
Get public key for the authenticated user
Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets.
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.
GitHub Apps must have read access to the codespaces_user_secrets
user permission to use this endpoint.
resources
Resources
@spec get_repo_public_key(String.t(), String.t(), keyword()) :: {:ok, GitHub.Codespace.PublicKey.t()} | {:error, GitHub.Error.t()}
Get a repository public key
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 write access to the codespaces_secrets
repository permission to use this endpoint.
resources
Resources
@spec get_repo_secret(String.t(), String.t(), String.t(), keyword()) :: {:ok, GitHub.RepoCodespacesSecret.t()} | {:error, GitHub.Error.t()}
Get a repository secret
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 write access to the codespaces_secrets
repository permission to use this endpoint.
resources
Resources
@spec get_secret_for_authenticated_user( String.t(), keyword() ) :: {:ok, GitHub.Codespace.Secret.t()} | {:error, GitHub.Error.t()}
Get a secret for the authenticated user
Gets a secret available to a user's codespaces without revealing its encrypted value.
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.
GitHub Apps must have read access to the codespaces_user_secrets
user permission to use this endpoint.
resources
Resources
list_devcontainers_in_repository_for_authenticated_user(owner, repo, opts \\ [])
View Source@spec list_devcontainers_in_repository_for_authenticated_user( String.t(), String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
List devcontainer configurations in a repository for the authenticated user
Lists the devcontainer.json files associated with a specified repository and the authenticated user. These files specify launchpoint configurations for codespaces created within the repository.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces_metadata
repository permission to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
@spec list_for_authenticated_user(keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List codespaces for the authenticated user
Lists the authenticated user's codespaces.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces
repository permission to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.repository_id
: ID of the Repository to filter on
resources
Resources
@spec list_in_organization( String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
List codespaces for the organization
Lists the codespaces associated to a specified organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
list_in_repository_for_authenticated_user(owner, repo, opts \\ [])
View Source@spec list_in_repository_for_authenticated_user(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List codespaces in a repository for the authenticated user
Lists the codespaces associated to a specified repository and the authenticated user.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces
repository permission to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
@spec list_org_secrets( String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
List organization secrets
Lists all Codespaces secrets available at the organization-level without revealing their encrypted values.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
@spec list_repo_secrets(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List repository secrets
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 write access to the codespaces_secrets
repository permission to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
list_repositories_for_secret_for_authenticated_user(secret_name, opts \\ [])
View Source@spec list_repositories_for_secret_for_authenticated_user( String.t(), keyword() ) :: {:ok, map()} | {:error, GitHub.Error.t()}
List selected repositories for a user secret
List the repositories that have been granted the ability to use a user's codespace secret.
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.
GitHub Apps must have read access to the codespaces_user_secrets
user permission and write access to the codespaces_secrets
repository permission on all referenced repositories to use this endpoint.
resources
Resources
@spec list_secrets_for_authenticated_user(keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List secrets for the authenticated user
Lists all secrets available for a user's Codespaces without revealing their encrypted values.
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.
GitHub Apps must have read access to the codespaces_user_secrets
user permission to use this endpoint.
options
Options
per_page
: The number of results per page (max 100).page
: Page number of the results to fetch.
resources
Resources
@spec list_selected_repos_for_org_secret(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List selected repositories for an organization secret
Lists all repositories that have been selected when the visibility
for repository access to a secret is set to selected
. You must authenticate using an access token with the admin:org
scope to use this endpoint.
options
Options
page
: Page number of the results to fetch.per_page
: The number of results per page (max 100).
resources
Resources
pre_flight_with_repo_for_authenticated_user(owner, repo, opts \\ [])
View Source@spec pre_flight_with_repo_for_authenticated_user(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
Get default attributes for a codespace
Gets the default attributes for codespaces created by the user with the repository.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
options
Options
ref
: The branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked.client_ip
: An alternative IP for default location auto-detection, such as when proxying a request.
resources
Resources
@spec publish_for_authenticated_user(String.t(), map(), keyword()) :: {:ok, GitHub.Codespace.WithFullRepository.t()} | {:error, GitHub.Error.t()}
Create a repository from an unpublished codespace
Publishes an unpublished codespace, creating a new repository and assigning it to the codespace.
The codespace's token is granted write permissions to the repository, allowing the user to push their changes.
This will fail for a codespace that is already published, meaning it has an associated repository.
You must authenticate using a personal access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.
resources
Resources
remove_repository_for_secret_for_authenticated_user(secret_name, repository_id, opts \\ [])
View Source@spec remove_repository_for_secret_for_authenticated_user( String.t(), integer(), keyword() ) :: :ok | {:error, GitHub.Error.t()}
Remove a selected repository from a user secret
Removes a repository from the selected repositories for a user's codespace secret.
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.
GitHub Apps must have write access to the codespaces_user_secrets
user permission to use this endpoint.
resources
Resources
remove_selected_repo_from_org_secret(org, secret_name, repository_id, opts \\ [])
View Source@spec remove_selected_repo_from_org_secret( String.t(), String.t(), integer(), keyword() ) :: :ok | {:error, GitHub.Error.t()}
Remove selected repository from an organization secret
Removes a repository from an organization secret when the visibility
for repository access is set to selected
. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec repo_machines_for_authenticated_user(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GitHub.Error.t()}
List available machine types for a repository
List the machine types available for a given repository based on its configuration.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces_metadata
repository permission to use this endpoint.
options
Options
location
: The location to check for available machines. Assigned by IP if not provided.client_ip
: IP for location auto-detection when proxying a requestref
: The branch or commit to check for prebuild availability and devcontainer restrictions.
resources
Resources
@spec set_codespaces_access(String.t(), map(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Manage access control for organization codespaces
Sets which users can access codespaces in an organization. This is synonymous with granting or revoking codespaces access permissions for users according to the visibility.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec set_codespaces_access_users(String.t(), map(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Add users to Codespaces access for an organization
Codespaces for the specified users will be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members
.
For information on how to change this setting, see "Manage access control for organization codespaces."
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
set_repositories_for_secret_for_authenticated_user(secret_name, body, opts \\ [])
View Source@spec set_repositories_for_secret_for_authenticated_user(String.t(), map(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Set selected repositories for a user secret
Select the repositories that will use a user's codespace secret.
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.
GitHub Apps must have write access to the codespaces_user_secrets
user permission and write access to the codespaces_secrets
repository permission on all referenced repositories to use this endpoint.
resources
Resources
set_selected_repos_for_org_secret(org, secret_name, body, opts \\ [])
View Source@spec set_selected_repos_for_org_secret(String.t(), String.t(), map(), keyword()) :: :ok | {:error, GitHub.Error.t()}
Set selected repositories for an organization secret
Replaces all repositories for an organization secret when the visibility
for repository access is set to selected
. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec start_for_authenticated_user( String.t(), keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Start a codespace for the authenticated user
Starts a user's codespace.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces_lifecycle_admin
repository permission to use this endpoint.
resources
Resources
@spec stop_for_authenticated_user( String.t(), keyword() ) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Stop a codespace for the authenticated user
Stops a user's codespace.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces_lifecycle_admin
repository permission to use this endpoint.
resources
Resources
@spec stop_in_organization(String.t(), String.t(), String.t(), keyword()) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Stop a codespace for an organization user
Stops a user's codespace.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
resources
Resources
@spec update_for_authenticated_user(String.t(), map(), keyword()) :: {:ok, GitHub.Codespace.t()} | {:error, GitHub.Error.t()}
Update a codespace for the authenticated user
Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.
If you specify a new machine type it will be applied the next time your codespace is started.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces
repository permission to use this endpoint.