project_snippets
Gets or lists a project_snippets resource.
Overview​
| Name | project_snippets |
| Type | Resource |
| Id | gitlab.snippets.project_snippets |
Fields​
The following fields are returned by SELECT queries:
- list
GraphQL response envelope
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the snippet. |
file_name | string | File Name of the snippet. |
author | object | UserCore identity (id, username, name) |
created_at | string | Timestamp the snippet was created. |
description | string | Description of the snippet. |
hidden | boolean | Indicates the snippet is hidden because the author has been banned. |
http_url_to_repo | string | HTTP URL to the snippet repository. |
imported | boolean | Indicates whether the snippet was imported. |
imported_from | string | Import source of the snippet. (NONE, GITLAB_MIGRATION, GITLAB_PROJECT, GITLAB_GROUP, GITHUB, BITBUCKET, BITBUCKET_SERVER, FOGBUGZ, GITEA, GIT, MANIFEST, CUSTOM_TEMPLATE, JIRA, OFFLINE_TRANSFER) |
project | object | Project identity (id, full_path, name) |
raw_url | string | Raw URL of the snippet. |
ssh_url_to_repo | string | SSH URL to the snippet repository. |
title | string | Title of the snippet. |
updated_at | string | Timestamp the snippet was updated. |
visibility_level | string | Visibility Level of the snippet. (private, internal, public) |
web_url | string | Web URL of the snippet. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | full_path, host | visibility | Snippets of the project. Generated from the GitLab GraphQL schema field Project.snippets (connection of Snippet nodes). |
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.
| Name | Datatype | Description |
|---|---|---|
full_path | string | Full path of the project, for example gitlab-org/gitlab |
host | string | GitLab host, with an optional port (default gitlab.com). Resolved from the GITLAB_HOST environment variable when it is set (x-stackQL-envVar); a WHERE host value always takes precedence. Self-managed instances: the provider is generated from the gitlab.com schema, so older instances may reject fields they do not serve. (default: gitlab.com, x-stackQL-envVar: GITLAB_HOST) |
visibility | string | Visibility of the snippet. |
SELECT examples​
- list
Snippets of the project. Generated from the GitLab GraphQL schema field Project.snippets (connection of Snippet nodes).
SELECT
id,
file_name,
author,
created_at,
description,
hidden,
http_url_to_repo,
imported,
imported_from,
project,
raw_url,
ssh_url_to_repo,
title,
updated_at,
visibility_level,
web_url
FROM gitlab.snippets.project_snippets
WHERE full_path = '{{ full_path }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
AND visibility = '{{ visibility }}'
;