Skip to content

Commit fae0b8b

Browse files
committed
Allow the issue API to add label ids
1 parent 2f1d9fc commit fae0b8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Sdk/Issues.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ public function delete(Dto\Issue $issue): bool
104104
return $issueArr['issueDelete']['success'];
105105
}
106106

107-
public function create(string $title, string $description, Dto\Team $team, ?int $priority = 0, ?Dto\Project $project = null): Dto\Issue
107+
public function create(string $title, string $description, Dto\Team $team, ?int $priority = 0, ?Dto\Project $project = null, array $labels = []): Dto\Issue
108108
{
109109
$input = [
110110
'title' => $title,
111111
'description' => $description,
112112
'teamId' => $team->id,
113113
'priority' => $priority,
114114
'projectId' => $issue->project->id ?? null,
115+
'labelIds' => $labels ?? [],
115116
];
116117

117118
$query = "
@@ -124,6 +125,7 @@ public function create(string $title, string $description, Dto\Team $team, ?int
124125
number
125126
priority
126127
priorityLabel
128+
labelIds
127129
state {
128130
id
129131
name
@@ -145,6 +147,8 @@ public function create(string $title, string $description, Dto\Team $team, ?int
145147

146148
$issueArr = $this->process($response);
147149

150+
unset($issueArr['issueCreate']['issue']['labelIds']);
151+
148152
try {
149153
return Mapper::get()->map(Dto\Issue::class, Source::array($issueArr['issueCreate']['issue']));
150154
} catch (MappingError $error) {

0 commit comments

Comments
 (0)