ProjectsEnpointGroup
public class ProjectsEnpointGroup : EndpointGroup
This EndpointGroup communicates with Projects API
Projects API
Project visibility level
Project in GitLab can be either private, internal or public. This is determined by the visibility
field in the project.
Values for the project visibility level are:
private
: Project access must be granted explicitly for each user.internal
: The project can be cloned by any logged in user.public
: The project can be cloned without any authentication.
Project merge method
There are currently three options for merge_method to choose from:
merge
: A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.rebase_merge
: A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible. This way you could make sure that if this merge request would build, after merging to target branch it would also build.ff
: No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.
-
List all projects Get a list of all visible projects across GitLab for the authenticated user. When accessed without authentication, only public projects with “simple” fields are returned.
Query Parameters:
- Optional:
- archived: Boolean - Limit by archived status
- visibility: String - Limit by visibility public, internal, or private
- order_by: String - Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at
- sort: String - Return projects sorted in asc or desc order. Default is desc
- search: String - Return list of projects matching the search criteria
- simple boolean Return - only limited fields for each project. This is a no-op without authentication as then only simple fields are returned:
- owned: Boolean - Limit by projects explicitly owned by the current user
- membership: Boolean - Limit by projects that the current user is a member of
- starred: Boolean - Limit by projects starred by the current user
- statistics: Boolean - Include project statistics
- with_custom_attributes: Boolean - Include custom attributes in response (admins only)
- with_issues_enabled: Boolean - Limit by enabled issues feature
- with_merge_requests_enabled: Boolean - Limit by enabled merge requests feature
- wiki_checksum_failed: Boolean - Limit projects where the wiki checksum calculation has failed (Introduced in GitLab Premium 11.2)
- repository_checksum_failed: Boolean - Limit projects where the repository checksum calculation has failed (Introduced in GitLab Premium 11.2)
min_access_level: Integer - Limit by current user minimal access level
Declaration
Swift
public func getProjects(parameters: QueryParameters? = nil, page: Int = 1, perPage: Int = RxGitLabAPIClient.defaultPerPage) -> Observable<[Project]>
Return Value
An
Observable
of list of projects in a project -
Undocumented
Declaration
Swift
public func getProjects(parameters: QueryParameters? = nil) -> Paginator<Project>
-
Get single project
Get a specific project. This endpoint can be accessed without authentication if the project is publicly accessible.
Declaration
Swift
public func getProject(projectID: Int, parameters: QueryParameters? = nil) -> Observable<Project>
Parameters
projectID
ID of the project
Return Value
An
Observable
ofProject
-
Get project users
Get the users list of a project. The pagination parameters page and per_page can be used to restrict the list of references.
- userID: ID of the user
- page: The page number
Optional Query Parameters:
- user_id: String - The ID or username of the user
- archived: Boolean - Limit by archived status
- visibility: String - Limit by visibility public, internal, or private
- order_by: String - Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at
- sort: String - Return projects sorted in asc or desc order. Default is desc
- search: String - Return list of projects matching the search criteria
- simple: Boolean - Return only limited fields for each project. This is a no-op without authentication as then only simple fields are returned.
- owned: Boolean - Limit by projects explicitly owned by the current user
- membership: Boolean - Limit by projects that the current user is a member of
- starred: Boolean - Limit by projects starred by the current user
- statistics: Boolean - Include project statistics
- with_custom_attributes: Boolean - Include custom attributes in response (admins only)
- with_issues_enabled: Boolean - Limit by enabled issues feature
- with_merge_requests_enabled: Boolean - Limit by enabled merge requests feature
- min_access_level: Integer - Limit by current user minimal access level
Declaration
Swift
public func getUserProjects(userID: Int, parameters: QueryParameters? = nil, page: Int = 1) -> Observable<[Project]>
Return Value
An
Observable
of list ofProject
-
Get project users
Get the paginator of users list of a project.
- userID: ID of the user
Optinal Query Parameters:
- user_id: String - The ID or username of the user
- archived: Boolean - Limit by archived status
- visibility: String - Limit by visibility public, internal, or private
- order_by: String - Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at
- sort: String - Return projects sorted in asc or desc order. Default is desc
- search: String - Return list of projects matching the search criteria
- simple: Boolean - Return only limited fields for each project. This is a no-op without authentication as then only simple fields are returned.
- owned: Boolean - Limit by projects explicitly owned by the current user
- membership: Boolean - Limit by projects that the current user is a member of
- starred: Boolean - Limit by projects starred by the current user
- statistics: Boolean - Include project statistics
- with_custom_attributes: Boolean - Include custom attributes in response (admins only)
- with_issues_enabled: Boolean - Limit by enabled issues feature
- with_merge_requests_enabled: Boolean - Limit by enabled merge requests feature
- min_access_level: Integer - Limit by current user minimal access level
Declaration
Swift
public func getUserProjects(userID: Int, parameters: QueryParameters? = nil) -> Paginator<Project>
-
Get project users
Get the users list of a project.
- projectID: The ID or URL-encoded path of the project
Declaration
Swift
public func getProjectUsers(projectID: Int) -> Observable<[User]>
Return Value
An
Observable
of list of Users -
Remove project
Removes a project including all associated resources (issues, merge requests etc.)
Declaration
Swift
public func deleteProject(projectID: Int) -> Observable<HTTPURLResponse>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of serverHTTPURLResponse
-
Create project for user
Creates a new project owned by the specified user. Available only for admins.
- project: A Project Object
- userID: The user ID of the project owner
Declaration
Return Value
An
Observable
of the posted Project -
Fork project
Forks a project into the user namespace of the authenticated user or the one provided. The forking operation for a project is asynchronous and is completed in a background job. The request will return immediately. To determine whether the fork of the project has completed, query the
import_status
for the new project.- projectID: The ID or URL-encoded path of the project
- namespace: The ID or path of the namespace that the project will be forked to
Declaration
Swift
public func forkProject(projectID: Int, namespace: String) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse
-
List Forks of a project
List the projects accessible to the calling user that have an established, forked relationship with the specified project
- projectID: projectID descriptionThe ID or URL-encoded path of the project
- Optional:
- archived: Boolean - Limit by archived status
- visibility: String - Limit by visibility public, internal, or private
- order_by: String - Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at
- sort: String - Return projects sorted in asc or desc order. Default is desc
- search: String - Return list of projects matching the search criteria
- simple: Boolean - Return only limited fields for each project. This is a no-op without authentication as then only simple fields are returned.
- owned: Boolean - Limit by projects explicitly owned by the current user
- membership: Boolean - Limit by projects that the current user is a member of
- starred: Boolean - Limit by projects starred by the current user
- statistics: Boolean - Include project statistics
- with_custom_attributes: Boolean - Include custom attributes in response (admins only)
- with_issues_enabled: Boolean - Limit by enabled issues feature
- with_merge_requests_enabled: Boolean - Limit by enabled merge requests feature
- min_access_level: Integer - Limit by current user minimal access level
Declaration
Swift
public func getProjectForks(projectID: Int, parameters: QueryParameters? = nil ) -> Observable<[Project]>
Return Value
An
Observable
of list of projects -
Star a project
Stars a given project. Returns status code
304
if the project is already starred.Declaration
Swift
public func starProject(projectID: Int) -> Observable<Project>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of a starred project -
Unstar a project
Unstars a given project. Returns status code
304
if the project is not starred.Declaration
Swift
public func unstarProject(projectID: Int) -> Observable<Project>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of a starred project -
Languages
Get languages used in a project with percentage value.
Declaration
Swift
public func getLanguages(projectID: Int) -> Observable<[String : Double]>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of a dictionary of languages -
Archive a project
Archives the project if the user is either admin or the project owner of this project. This action is idempotent, thus archiving an already archived project will not change the project.
Declaration
Swift
public func archiveProject(projectID: Int) -> Observable<Project>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of a project -
Unarchive a project
Unarchives the project if the user is either admin or the project owner of this project. This action is idempotent, thus unarchiving a non-archived project will not change the project.
Declaration
Swift
public func unarchiveProject(projectID: Int) -> Observable<Project>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of a project -
Share project with group
Allow to share project with group.
- projectID: The ID or URL-encoded path of the project
- groupID: The ID of the group to share with
- groupAccess: The permissions level to grant the group
- expiresAt: Share expiration date
Declaration
Swift
public func shareProjectWithGroup(projectID: Int, groupID: Int, groupAccess: Int, expiresAt: Date? = nil) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse
-
Delete a shared project link within a group
Unshare the project from the group. Returns
204
and no content on success.- projectID: The ID or URL-encoded path of the project
- groupID: The ID of the group
Declaration
Swift
public func deleteSharedProjectWithinGroup(projectID: Int, groupID: Int) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse
-
List project hooks
Get a list of project hooks.
- projectID: The ID or URL-encoded path of the project
- page: The page number
- perPage: Maximum item count per page
Declaration
Swift
public func getHooks(projectID: Int, page: Int = 1, perPage: Int = RxGitLabAPIClient.defaultPerPage) -> Paginator<ProjectHook>
Return Value
A
Paginator
ofHook
-
Get project hook
Get a specific hook for a project.
- projectID: The ID or URL-encoded path of the project
- hookID: The ID of a project hook
Declaration
Swift
public func getHook(projectID: Int, hookID: Int) -> Observable<ProjectHook>
Return Value
An
Observable
of aProjectHook
-
Add project hook
Adds a hook to a specified project.
- projectID: The ID of a project hook
- hook: A Hook to be created
Declaration
Swift
public func postHook(projectID: Int, hook: ProjectHook) -> Observable<ProjectHook>
Return Value
An
Observable
of serverHTTPURLResponse
-
Edit project hook
Edits a hook for a specified project.
- projectID: The ID or URL-encoded path of the project
- hook: A hook to be updated
Declaration
Swift
public func putHook(projectID: Int, hook: ProjectHook) -> Observable<ProjectHook>
Return Value
An
Observable
of serverHTTPURLResponse
-
Delete project hook
Removes a hook from a project. This is an idempotent method and can be called multiple times. Either the hook is available or not.
projectID: The ID or URL-encoded path of the project
hookID: The ID of the project hook
Declaration
Swift
public func deleteHook(projectID: Int, hookID: Int) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse
-
Create a forked from/to relation between existing projects
- projectID: The ID or URL-encoded path of the project
- forkedFromID: The ID of the project that was forked from
Declaration
Swift
public func postForkRelation(projectID: Int, forkedFromID: Int) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse
-
Delete an existing forked from relationship
Declaration
Swift
public func deleteForkRelation(projectID: Int) -> Observable<HTTPURLResponse>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of serverHTTPURLResponse
-
Start the Housekeeping task for a Project
Declaration
Swift
public func postHousekeeping(projectID: Int) -> Observable<HTTPURLResponse>
Parameters
projectID
The ID or URL-encoded path of the project
Return Value
An
Observable
of serverHTTPURLResponse
-
Transfer a project to a new namespace
- projectID: The ID of the project
- namespace: The ID or path of the namespace to transfer to project to
Declaration
Swift
public func putTransfer(projectID: Int, namespace: String) -> Observable<HTTPURLResponse>
Return Value
An
Observable
of serverHTTPURLResponse