-
-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathDeployments.php
More file actions
58 lines (51 loc) · 2.42 KB
/
Deployments.php
File metadata and controls
58 lines (51 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
declare(strict_types=1);
/*
* This file is part of the Gitlab API library.
*
* (c) Matt Humphrey <[email protected]>
* (c) Graham Campbell <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Gitlab\Api;
class Deployments extends AbstractApi
{
/**
* @param array $parameters {
*
* @var string $order_by Return deployments ordered by id, iid, created_at, updated_at,
* or ref fields (default is id)
* @var string $sort Return deployments sorted in asc or desc order (default is desc)
* @var string $status Return deployments filtered by status of deployment allowed
* values of status are 'created', 'running', 'success', 'failed',
* 'canceled', 'blocked'
* @var string $environment Return deployments filtered to a particular environment
* }
*/
public function all(int|string $project_id, array $parameters = []): mixed
{
$resolver = $this->createOptionsResolver();
$resolver->setDefined('order_by')
->setAllowedTypes('order_by', 'string')
->setAllowedValues('order_by', ['id', 'iid', 'created_at', 'updated_at', 'ref']);
$resolver->setDefined('sort')
->setAllowedTypes('sort', 'string')
->setAllowedValues('sort', ['desc', 'asc']);
$resolver->setDefined('status')
->setAllowedTypes('status', 'string')
->setAllowedValues('status', ['created', 'running', 'success', 'failed', 'canceled', 'blocked']);
$resolver->setDefined('environment')
->setAllowedTypes('environment', 'string');
return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters));
}
public function show(int|string $project_id, int $deployment_id): mixed
{
return $this->get($this->getProjectPath($project_id, 'deployments/'.$deployment_id));
}
public function showMergeRequests(int|string $project_id, int $deployment_id): mixed
{
return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id).'/merge_requests'));
}
}