|
|
# NAME
|
|
|
|
|
|
`GitLab::Projects` - implements projects API calls
|
|
|
|
|
|
See [GitLab API -- Projects](http://doc.gitlab.com/ce/api/projects.html) for details and
|
|
|
response formats.
|
|
|
|
|
|
# VERSION
|
|
|
|
|
|
Implements API calls for GitLab CE `v8.10.0`.
|
|
|
Checked 2016-09-29 for GitLab CE `v8.12.1`.
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
## Notation
|
|
|
|
|
|
Please see the documentation for the [`GitLab::Users`](GitLab-Users.md) module.
|
|
|
|
|
|
Note that not all optional arguments are listed.
|
|
|
Please refer to the official documentation for the full list.
|
|
|
|
|
|
## Project listing
|
|
|
|
|
|
- `projects()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->projects([...]);
|
|
|
```
|
|
|
|
|
|
Returns a list of projects accessible to the authenticated user.
|
|
|
|
|
|
- `projects_owned()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->projects_owned([...]);
|
|
|
```
|
|
|
|
|
|
Returns a list of projects owned by the authenticated user.
|
|
|
|
|
|
- `projects_starred()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->projects_starred([...]);
|
|
|
```
|
|
|
|
|
|
Returns a list of projects starred by the authenticated user.
|
|
|
|
|
|
- `projects_all()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->projects_all([...]);
|
|
|
```
|
|
|
|
|
|
Returns all projects.
|
|
|
**This method is available only for administrators.**
|
|
|
|
|
|
- `project_by_id()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_by_id( :id );
|
|
|
```
|
|
|
|
|
|
Returns the project with the given ID, which can be either a number or a string `"namespace/project_name"`.
|
|
|
|
|
|
- `project_events()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_events( :id );
|
|
|
```
|
|
|
|
|
|
Returns the list of events for the given project.
|
|
|
|
|
|
- `projects_search()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->projects_serach( :query, [...] );
|
|
|
```
|
|
|
|
|
|
Search for projects by name which are accessible to the authenticated user.
|
|
|
|
|
|
## Create, edit and delete projects
|
|
|
|
|
|
- `project_create()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_create( :name, [...] );
|
|
|
```
|
|
|
|
|
|
Creates a new project in the authenticated user's namespace.
|
|
|
Other namespaces can be specified by the optional `namespace_id` parameter if the user can access it.
|
|
|
|
|
|
- `project_create_for_user()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_create_for_user( :uid, :name );
|
|
|
```
|
|
|
|
|
|
Creates a new project for the user with the given `uid`.
|
|
|
**This method is available only for administrators.**
|
|
|
|
|
|
- `project_edit()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_edit( :id, [...] );
|
|
|
```
|
|
|
|
|
|
Edits the project.
|
|
|
Takes the same arguments as [`project_create`](#project_create), except they are all optional.
|
|
|
|
|
|
- `project_fork()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_fork( :id, [:namespace ] );
|
|
|
```
|
|
|
|
|
|
Forks the project to the authenticated user's namespace or the namespace specified by the `namespace` as an id or path.
|
|
|
|
|
|
- `project_star()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_star( :id );
|
|
|
```
|
|
|
|
|
|
Stars a given project.
|
|
|
Returns `304 Not Modified` if already stared.
|
|
|
|
|
|
- `project_unstar()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_unstar( :id );
|
|
|
```
|
|
|
|
|
|
Unstars a given project.
|
|
|
Returns `304 Not Modified` if not stared.
|
|
|
|
|
|
- `project_archive()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_archive( :id );
|
|
|
```
|
|
|
|
|
|
Archives the given project.
|
|
|
The user must be either an administrator or the owner of the project.
|
|
|
|
|
|
- `project_unarchive()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_unarchive( :id );
|
|
|
```
|
|
|
|
|
|
Unarchives the given project.
|
|
|
The user must be either an administrator or the owner of the project.
|
|
|
|
|
|
- `project_delete()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_delete( :id );
|
|
|
```
|
|
|
|
|
|
Deletes the project with the given `id`.
|
|
|
|
|
|
## Uploads
|
|
|
|
|
|
- `project_upload_file()`
|
|
|
|
|
|
**NOT SUPPORTED YET**
|
|
|
|
|
|
## Project Members
|
|
|
|
|
|
See [`GitLab::Members`](GitLab-Members.md) package.
|
|
|
|
|
|
## Hooks
|
|
|
|
|
|
- `project_hooks()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_hooks( :id );
|
|
|
```
|
|
|
|
|
|
Get a list of project hooks.
|
|
|
|
|
|
- `project_get_hook()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_get_hook( :id, :hook_id )
|
|
|
```
|
|
|
|
|
|
Get a specific hook for a project.
|
|
|
|
|
|
- `project_add_hook()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_add_hook( :id, :url, [...]);
|
|
|
```
|
|
|
|
|
|
Adds a hook to a specified project.
|
|
|
|
|
|
- `project_edit_hook()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_edit_hook( :id, :hook_id, [...]);
|
|
|
```
|
|
|
|
|
|
Edits a hook for a specified project.
|
|
|
|
|
|
- `project_delete_hook()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_delete_hook( :id, :hook_id );
|
|
|
```
|
|
|
|
|
|
Removes a hook from a project.
|
|
|
This is an idempotent method and can be called multiple times.
|
|
|
|
|
|
Note the JSON response differs if the hook is available or not.
|
|
|
If the project hook is available before it is returned in the JSON response or an empty response is returned.
|
|
|
|
|
|
## Branches
|
|
|
|
|
|
See [`GitLab::Branches`](GitLab-Branches.md) module.
|
|
|
|
|
|
## Miscellaneous
|
|
|
|
|
|
**The following methods are available only for admins.**
|
|
|
|
|
|
- `project_create_forked_relationship()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_create_forked_relationship( :id :forked_from_id );
|
|
|
```
|
|
|
|
|
|
Create a _forked from_ relation between existing projects.
|
|
|
|
|
|
- `project_delete_forked_relationship()`
|
|
|
|
|
|
```{.pl}
|
|
|
$gitlab->project_delete_forked_relationship( :id );
|
|
|
```
|
|
|
|
|
|
Delete an existing _forked from_ relationship.
|
|
|
|
|
|
# AUTHOR
|
|
|
|
|
|
Roman Lacko <[`xlacko1@fi.muni.cz`](mailto:xlacko1@fi.muni.cz)>
|
|
|
|
|
|
# SEE ALSO
|
|
|
|
|
|
- [`GitLab`](GitLab.md)
|
|
|
|
|
|
Wrapper around [`GitLab::API`](GitLab-API.md) and other `GitLab::*` modules. |