Skip to main content

resources

Creates, updates, deletes, gets or lists a resources resource.

Overview

Nameresources
TypeResource
Idgithub.copilot_spaces.resources

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe unique identifier of the resource.
copilot_chat_attachment_idintegerThe ID of the associated chat attachment, if any.
created_atstring (date-time)The date and time the resource was created.
metadataobjectResource-specific metadata. The keys and values depend on the resource type.
resource_typestringThe type of the resource. (repository, github_file, free_text, github_issue, github_pull_request, media_content, uploaded_text_file)
updated_atstring (date-time)The date and time the resource was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_resource_for_orgselectorg, space_number, space_resource_idGets a specific resource attached to a Copilot Space owned by an organization.
The authenticated user must have appropriate permissions to view the space.

OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.
get_resource_for_userselectusername, space_number, space_resource_idGets a specific resource attached to a Copilot Space owned by a user.
The authenticated user must have appropriate permissions to view the space.

OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.
list_resources_for_orgselectorg, space_numberLists all resources attached to a specific Copilot Space owned by an organization.
The authenticated user must have appropriate permissions to view the space.

OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.
list_resources_for_userselectusername, space_numberLists all resources attached to a specific Copilot Space owned by a user.
The authenticated user must have appropriate permissions to view the space.

OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.
create_resource_for_orginsertorg, space_number, resource_type, metadataCreates a new resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

The following resource types are supported: repository, github_file, free_text, github_issue, github_pull_request.
The uploaded_text_file and media_content types are not supported via this endpoint.

For github_file resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a 200 status.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being created.
create_resource_for_userinsertusername, space_number, resource_type, metadataCreates a new resource in a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.

The following resource types are supported: repository, github_file, free_text, github_issue, github_pull_request.
The uploaded_text_file and media_content types are not supported via this endpoint.

For github_file resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a 200 status.

OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.
update_resource_for_orgreplaceorg, space_number, space_resource_idUpdates the metadata of a resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being updated.
update_resource_for_userreplaceusername, space_number, space_resource_idUpdates the metadata of a resource in a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.
delete_resource_for_orgdeleteorg, space_number, space_resource_idDeletes a resource from a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.
delete_resource_for_userdeleteusername, space_number, space_resource_idDeletes a resource from a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
space_numberintegerThe unique identifier of the Copilot Space.
space_resource_idintegerThe unique identifier of the resource.
usernamestringThe handle for the GitHub user account.

SELECT examples

Gets a specific resource attached to a Copilot Space owned by an organization.
The authenticated user must have appropriate permissions to view the space.

OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

SELECT
id,
copilot_chat_attachment_id,
created_at,
metadata,
resource_type,
updated_at
FROM github.copilot_spaces.resources
WHERE org = '{{ org }}' -- required
AND space_number = '{{ space_number }}' -- required
AND space_resource_id = '{{ space_resource_id }}' -- required
;

INSERT examples

Creates a new resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

The following resource types are supported: repository, github_file, free_text, github_issue, github_pull_request.
The uploaded_text_file and media_content types are not supported via this endpoint.

For github_file resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a 200 status.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being created.

INSERT INTO github.copilot_spaces.resources (
resource_type,
metadata,
org,
space_number
)
SELECT
'{{ resource_type }}' /* required */,
'{{ metadata }}' /* required */,
'{{ org }}',
'{{ space_number }}'
RETURNING
id,
copilot_chat_attachment_id,
created_at,
metadata,
resource_type,
updated_at
;

REPLACE examples

Updates the metadata of a resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being updated.

REPLACE github.copilot_spaces.resources
SET
metadata = '{{ metadata }}'
WHERE
org = '{{ org }}' --required
AND space_number = '{{ space_number }}' --required
AND space_resource_id = '{{ space_resource_id }}' --required
RETURNING
id,
copilot_chat_attachment_id,
created_at,
metadata,
resource_type,
updated_at;

DELETE examples

Deletes a resource from a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

DELETE FROM github.copilot_spaces.resources
WHERE org = '{{ org }}' --required
AND space_number = '{{ space_number }}' --required
AND space_resource_id = '{{ space_resource_id }}' --required
;