Skip to main content

project_snippets

Gets or lists a project_snippets resource.

Overview​

Nameproject_snippets
TypeResource
Idgitlab.snippets.project_snippets

Fields​

The following fields are returned by SELECT queries:

GraphQL response envelope

NameDatatypeDescription
idstringID of the snippet.
file_namestringFile Name of the snippet.
authorobjectUserCore identity (id, username, name)
created_atstringTimestamp the snippet was created.
descriptionstringDescription of the snippet.
hiddenbooleanIndicates the snippet is hidden because the author has been banned.
http_url_to_repostringHTTP URL to the snippet repository.
importedbooleanIndicates whether the snippet was imported.
imported_fromstringImport source of the snippet. (NONE, GITLAB_MIGRATION, GITLAB_PROJECT, GITLAB_GROUP, GITHUB, BITBUCKET, BITBUCKET_SERVER, FOGBUGZ, GITEA, GIT, MANIFEST, CUSTOM_TEMPLATE, JIRA, OFFLINE_TRANSFER)
projectobjectProject identity (id, full_path, name)
raw_urlstringRaw URL of the snippet.
ssh_url_to_repostringSSH URL to the snippet repository.
titlestringTitle of the snippet.
updated_atstringTimestamp the snippet was updated.
visibility_levelstringVisibility Level of the snippet. (private, internal, public)
web_urlstringWeb URL of the snippet.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectfull_path, hostvisibilitySnippets 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.

NameDatatypeDescription
full_pathstringFull path of the project, for example gitlab-org/gitlab
hoststringGitLab 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)
visibilitystringVisibility of the snippet.

SELECT examples​

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 }}'
;