Commit e1e3910f authored by Roman Lacko's avatar Roman Lacko
Browse files

Update GitLab-Projects.md

parent a5e1ca51
Loading
Loading
Loading
Loading
+103 −56
Original line number Diff line number Diff line
# NAME

GitLab::Projects - implements projects API calls
`GitLab::Projects` - implements projects API calls

See [GitLab API -- Projects](http://doc.gitlab.com/ce/api/projects.html) for details and
response formats.
@@ -14,158 +14,200 @@ Checked 2016-09-29 for GitLab CE `v8.12.1`.

## Notation

Please see the documentation for the [GitLab::Users](https://metacpan.org/pod/GitLab::Users) module.
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()
- `projects()`

    ```{.pl}
    $gitlab->projects([...]);
    ```

    Returns a list of projects accessible to the authenticated user.

- projects\_owned()
- `projects_owned()`

    ```{.pl}
    $gitlab->projects_owned([...]);
    ```

    Returns a list of projects owned by the authenticated user.

- projects\_starred()
- `projects_starred()`

    ```{.pl}
    $gitlab->projects_starred([...]);
    ```

    Returns a list of projects starred by the authenticated user.

- projects\_all()
- `projects_all()`

    ```{.pl}
    $gitlab->projects_all([...]);
    ```

    Returns all projects.
    **This method is available only for administrators.**

- project\_by\_id()
- `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()
- `project_events()`

    ```{.pl}
    $gitlab->project_events( :id );
    ```

    Returns the list of events for the given project.

- projects\_search()
- `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()
- `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()
- `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()
- `project_edit()`

    ```{.pl}
    $gitlab->project_edit( :id, [...] );
    ```

    Edits the project.
    Takes the same arguments as [project\_create](https://metacpan.org/pod/project_create), except they are all optional.
    Takes the same arguments as [`project_create`](#project_create), except they are all optional.

- project\_fork()
- `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()
- `project_star()`

    ```{.pl}
    $gitlab->project_star( :id );
    ```

    Stars a given project.
    Returns `304 Not Modified` if already stared.

- project\_unstar()
- `project_unstar()`

    ```{.pl}
    $gitlab->project_unstar( :id );
    ```

    Unstars a given project.
    Returns `304 Not Modified` if not stared.

- project\_archive()
- `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()
- `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()
- `project_delete()`

    ```{.pl}
    $gitlab->project_delete( :id );
    ```

    Deletes the project with the given `id`.

## Uploads

- project\_upload\_file()
- `project_upload_file()`

    **NOT SUPPORTED YET**

## Project Members

See [GitLab::Members](https://metacpan.org/pod/GitLab::Members) package.
See [`GitLab::Members`](GitLab-Members.md) package.

## Hooks

- project\_hooks()
- `project_hooks()`

    ```{.pl}
    $gitlab->project_hooks( :id );
    ```

    Get a list of project hooks.

- project\_get\_hook()
- `project_get_hook()`

    ```{.pl}
    $gitlab->project_get_hook( :id, :hook_id )
    ```

    Get a specific hook for a project.

- project\_add\_hook()
- `project_add_hook()`

    ```{.pl}
    $gitlab->project_add_hook( :id, :url, [...]);
    ```

    Adds a hook to a specified project.

- project\_edit\_hook()
- `project_edit_hook()`

    ```{.pl}
    $gitlab->project_edit_hook( :id, :hook_id, [...]);
    ```

    Edits a hook for a specified project.

- project\_delete\_hook()
- `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.
@@ -175,29 +217,34 @@ See [GitLab::Members](https://metacpan.org/pod/GitLab::Members) package.

## Branches

See [GitLab::Branches](https://metacpan.org/pod/GitLab::Branches) module.
See [`GitLab::Branches`](GitLab-Branches.md) module.

## Miscellaneous

- project\_create\_forked\_relationship()
**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.
    **Available only for admins.**

- project\_delete\_forked\_relationship()
- `project_delete_forked_relationship()`

    ```{.pl}
    $gitlab->project_delete_forked_relationship( :id );
    ```

    Delete an existing _forked from_ relationship.

# AUTHOR

Roman Lacko <[xlacko1@fi.muni.cz](https://metacpan.org/pod/xlacko1@fi.muni.cz)>
Roman Lacko <[`xlacko1@fi.muni.cz`](mailto:xlacko1@fi.muni.cz)>

# SEE ALSO

- [GitLab](https://metacpan.org/pod/GitLab)
- [`GitLab`](GitLab.md)

    Wrapper around [GitLab::API](https://metacpan.org/pod/GitLab::API) and other `GitLab::*` modules.
    Wrapper around [`GitLab::API`](GitLab-API.md) and other `GitLab::*` modules.