+ Delete a Label by labelName.

This commit is contained in:
dingguodong
2021-06-25 14:39:31 +08:00
parent 6a64f459bc
commit 16488940d4
+25
View File
@@ -333,6 +333,31 @@ class gitlabModel extends model
return $labels;
}
/**
* Delete a Label by labelName.
*
* @param int $gitlabID
* @param int $projectID
* @param string $labelName
* @access public
* @return void
*/
public function apiDeleteLabel($gitlabID, $projectID, $labelName)
{
$labels = $this->apiGetLabels($gitlabID, $projectID);
foreach($labels as $label)
{
if($label->name == $labelName) $labelID = $label->id;
}
if(empty($labelID)) return false;
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/labels/{$labelID}";
return json_decode(commonModel::http($url, $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
}
/**
* Create zentao object label for gitlab project.
*