Skip to contents

Assembles the URL to the specified repository path for GitLab's web interface.

Usage

build_url(
  id_project = funky::config_val("id_project"),
  ...,
  ref = "HEAD",
  force_branch_ref = FALSE,
  base_url = funky::config_val("base_url"),
  token = funky::config_val("token"),
  max_tries = 3L
)

Arguments

id_project

integer(1)
GitLab project identifier.

...

character()
Optional path components added to the repository base URL.

ref

character(1)
Git revision expression matching the desired Git tree object, e.g. a ref name (branch, tag, etc.), a commit identifier, or another symbolic reference like "HEAD~10". Omitted if NULL, otherwise set as a URL parameter in the API request. Note that the GitLab API doesn't support every type of revision expression.

force_branch_ref

logical(1)
Whether or not to force ref to be interpreted as a branch name by adding the ref_type=heads URL parameter.

base_url

character(1)
Base URL to the GitLab v4 RESTful API root.

token

character(1)
GitLab access token used for authentication. If NULL, the API request is made unauthenticated which results in HTTP 404 Not Found and other errors for non-public resources.

max_tries

integer(1)
Maximum number of request attempts in case of an HTTP error. An integerish scalar. Retries are performed using exponential backoff and jitter, see httr2::req_retry() for details.

Value

A character scalar.

See also

Other common functions around GitLab's v4 RESTful API: api_req()

Examples

gitlab::build_url(id_project = 64767928,
                  "Rmd/gitlab.Rmd")
#> [1] "https://gitlab.com/rpkg.dev/gitlab/-/tree/HEAD/Rmd/gitlab.Rmd"