RepositoriesEndpointGroup

public class RepositoriesEndpointGroup : EndpointGroup

This EndpointGroup communicates with Repositories API

  • Get a list of repository files and directories in a project. This endpoint can be accessed without authentication if the repository is publicly accessible.

    This command provides essentially the same functionality as the git ls-tree command. For more information, see the section Tree Objects in the Git internals documentation.

    Optional Query Parameters:

    • path: String - The path inside repository. Used to get content of subdirectories
    • ref: String - The name of a repository branch or tag or if not given the default branch
    • recursive: String - Boolean value used to get a recursive tree (false by default)
    • per_page: Int - Number of results to show per page. If not specified, defaults to 20

    Declaration

    Swift

    public func getTree(projectID: Int, parameters: QueryParameters? = nil) -> Paginator<TreeNode>

    Parameters

    projectID

    The ID or URL-encoded path of the project

    parameters

    See Query Parameters in the description

    Return Value

    An Observable of TreeNodes

  • Get a blob from repository

    Allows you to receive information about blob in repository like size and content. Note that blob content is Base64 encoded. This endpoint can be accessed without authentication if the repository is publicly accessible.

    • projectID: The ID or URL-encoded path of the project owned by the authenticated user
    • sha: The blob SHA

    Declaration

    Swift

    public func getBlob(projectID: Int, sha: String) -> Observable<Data>

    Return Value

    An Observable of Data

  • Raw blob content Get the raw file contents for a blob by blob SHA. This endpoint can be accessed without authentication if the repository is publicly accessible.

    • projectID: The ID or URL-encoded path of the project owned by the authenticated user
    • sha: The blob SHA

    Declaration

    Swift

    public func getBlobRaw(projectID: Int, sha: String) -> Observable<Data>

    Return Value

    An Observable of Data

  • Get file archive

    Get an archive of the repository. This endpoint can be accessed without authentication if the repository is publicly accessible.

    • projectID: The ID or URL-encoded path of the project owned by the authenticated user
    • format: an optional suffix for the archive format. Default is tar.gz. Options are tar.gz, tar.bz2, tbz, tbz2, tb2, bz2, tar, and zip. For example, specifying archive.zip would send an archive in ZIP format.

    Declaration

    Swift

    public func getArchive(projectID: Int, format: String) -> Observable<Data>

    Return Value

    An Observable of Data

  • Compare branches, tags or commits

    This endpoint can be accessed without authentication if the repository is publicly accessible.

    • from: The commit SHA or branch name
    • to: The commit SHA or branch name

    Optional Query Parameters:

    • straight: Boolean - Limit by visibility public, internal, or private

    Declaration

    Swift

    public func getComparison(projectID: Int, from: String, to: String, parameters: QueryParameters? = [:]) -> Observable<Comparison>

    Return Value

    An Observable of list of Comparison

  • Contributors

    Get repository contributors list. This endpoint can be accessed without authentication if the repository is publicly accessible.

    **Optional Query Parameters:*

    • order_by: String - Return contributors ordered by name, email, or commits (orders by commit date) fields. Default is commits
    • sort: String - Return contributors sorted in asc or desc! order. Default isasc`.

    Declaration

    Swift

    public func getContributors(projectID: Int, parameters: QueryParameters? = nil, perPage: Int = RxGitLabAPIClient.defaultPerPage) -> Paginator<Contributor>

    Parameters

    projectID

    The ID or URL-encoded path of the project

    parameters

    See Query Parameters in the description

    Return Value

    An Observable of list of Contributor

  • Merge Base

    Get the common ancestor for 2 refs (commit SHAs, branch names or tags).

    Declaration

    Swift

    public func getMergeBase(projectID: Int, refs: [String]) -> Observable<Commit>

    Parameters

    projectID

    The ID or URL-encoded path of the project

    refs

    The refs to find the common ancestor of, multiple refs can be passed

    Return Value

    An Observable of list of Commit

  • Get file from repository

    Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. This endpoint can be accessed without authentication if the repository is publicly accessible.

    • projectID: The ID or URL-encoded path of the project
    • file_path: Url encoded full path to new file. Ex. lib%2Fclass%2Erb
    • ref: The name of branch, tag or commit

    Declaration

    Swift

    public func getFileInfo(projectID: Int, filePath: String, ref: String) -> Observable<FileInfo>

    Return Value

    An Observable of list of FileInfo

  • Get raw file from repository

    • projectID: The ID or URL-encoded path of the project
    • file_path: Url encoded full path to new file. Ex. lib%2Fclass%2Erb
    • ref: The name of branch, tag or commit

    Declaration

    Swift

    public func getFile(projectID: Int, filePath: String, ref: String) -> Observable<Data>

    Return Value

    An Observable of list of FileInfo

  • Create new file in repository

    This allows you to create a single file. For creating multiple files with a single request see the commits API.

    • file: File containing data
    • projectID: The ID or URL-encoded path of the project
    • filePath: Url encoded full path to new file. Ex. lib%2Fclass%2Erb

    Declaration

    Swift

    public func postFile(file: File, projectID: Int, filePath: String) -> Observable<File>

    Return Value

    An Observable of list of File

  • Update existing file in repository

    This allows you to update a single file. For updating multiple files with a single request see the commits API. If the commit fails for any reason we return a 400 error with a non-specific error message. Possible causes for a failed commit include: - the file_path contained /../ (attempted directory traversal); - the new file contents were identical to the current file contents, i.e. the user tried to make an empty commit; - the branch was updated by a Git push while the file edit was in progress.

    Currently gitlab-shell has a boolean return code, preventing GitLab from specifying the error.

    • file: File containing data
    • projectID: The ID or URL-encoded path of the project
    • filePath: Url encoded full path to new file. Ex. lib%2Fclass%2Erb

    Declaration

    Swift

    public func putFile(file: File, projectID: Int, filePath: String) -> Observable<FileInfo>

    Return Value

    An Observable of list of File

  • Delete existing file in repository This allows you to delete a single file. For deleting multiple files with a singleh request see the commits API.

    • projectID: The ID or URL-encoded path of the project
    • file_path: Url encoded full path to new file. Ex. lib%2Fclass%2Erb
    • ref: The name of branch, tag or commit

    Declaration

    Swift

    public func deleteFile(file: File, projectID: Int, filePath: String) -> Observable<HTTPURLResponse>

    Return Value

    An Observable of list of FileInfo