gitbeaker/docs/projects.md
Justin Dalrymple ecdf2391aa See readme
2017-12-17 15:01:44 -05:00

5.4 KiB

Projects API

Projects

Get all projects

Get a list of visible projects for authenticated user. When accessed without authentication, only public projects are returned.

let projects = GitlabAPI.projects.all();

Parameters: Get all projects

Extra Parameters

Argument Description Type Required Default
max_pages Limits the amount of pages returned Number No All pages

Get a single project

Get a specific project. This endpoint can be accessed without authentication if the project is publicly accessible.

// From a project ID
let projectA = GitlabAPI.projects.show(21);

// From a projects url
let projectB = GitlabAPI.projects.show('diaspora/diaspora');

Parameters: Get a single project

Create a project

Creates a new project owned by the authenticated user.

let projectA = GitlabAPI.projects.create({
  // params
});

Parameters: Create a project

Create a project for user

Creates a new project owned by the specified user. Available only for admins.

let projectA = GitlabAPI.projects.create({
	userId: 5,
  // params
});

Parameters: Create a project for user

Edit a project

Creates a new project owned by the specified user. Available only for admins.

let projectA = GitlabAPI.projects.edit(projectId, {
  // params
});

Parameters: Edit a project

Fork a project

Forks a project into the user namespace of the authenticated user or the one provided.

let projectA = GitlabAPI.projects.fork(projectId, {
  // params
});

Parameters: Fork a project

Star a project

Stars a given project. Returns status code 304 if the project is already starred.

let projectA = GitlabAPI.projects.star(projectId);

Parameters: Star a project

Unstar a project

Unstars a given project. Returns status code 304 if the project is not starred.

let projectA = GitlabAPI.projects.unstar(projectId);

Parameters: Unstar a project

Remove a project

Removes a project including all associated resources (issues, merge requests etc.)

GitlabAPI.projects.remove(projectId);

Parameters: Remove a project

Search for a project

Search for projects by name which are accessible to the authenticated user. This endpoint can be accessed without authentication if the project is publicly accessible.

GitlabAPI.projects.search(query);

Parameters: Search for a project

Post the build status to a commit

Search for projects by name which are accessible to the authenticated user. This endpoint can be accessed without authentication if the project is publicly accessible.

GitlabAPI.projects.search(query);

Parameters: Search for a project

Share a project with a group

Allow to share project with group.

GitlabAPI.projects.share(projectId, groupId, groupAccess, {
	// params
});

Parameters: Share a project with a group

Unshare a project with a group

Unshare the project from the group.

GitlabAPI.projects.unshare(projectId, groupId);

Parameters: Unshare a project with a group