-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIteration.php
53 lines (47 loc) · 1.56 KB
/
Iteration.php
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
<?php
declare(strict_types=1);
namespace Coding;
class Iteration extends Base
{
public function create(array $data): array
{
$this->validate($data, [
'Name' => 'string|required',
'Goal' => 'nullable|string',
'Assignee' => 'nullable|integer',
'StartAt' => 'nullable|date_format:Y-m-d',
'EndAt' => 'nullable|date_format:Y-m-d|after:StartAt',
]);
$response = $this->client->requestProjectApi('CreateIteration', $data);
return $response['Iteration'];
}
public function get(array $data): array
{
$this->validate($data, [
'IterationCode' => 'integer|required',
]);
$response = $this->client->requestProjectApi('DescribeIteration', $data);
return $response['Iteration'];
}
public function update(array $data): array
{
$this->validate($data, [
'IterationCode' => 'integer|required',
'Name' => 'nullable|string',
'Goal' => 'nullable|string',
'Assignee' => 'nullable|integer',
'StartAt' => 'nullable|date_format:Y-m-d',
'EndAt' => 'nullable|date_format:Y-m-d|after:StartAt',
]);
$response = $this->client->requestProjectApi('ModifyIteration', $data);
return $response['Iteration'];
}
public function delete(array $data): bool
{
$this->validate($data, [
'IterationCode' => 'integer|required',
]);
$this->client->requestProjectApi('DeleteIteration', $data);
return true;
}
}