client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/issues/' . $index . '/labels'); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $index * @param array $labels * @return array */ public function replaceLabels(string $owner, string $repositoryName, int $index, array $labels): array { $options['json'] = [ 'labels' => $labels ]; $response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/issues/' . $index . '/labels', 'PUT', $options); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $index * @param array $labels * @return array */ public function addLabels(string $owner, string $repositoryName, int $index, array $labels): array { $options['json'] = [ 'labels' => $labels ]; $response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/issues/' . $index . '/labels', 'POST', $options); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $index * @return bool */ public function deleteAllLabels(string $owner, string $repositoryName, int $index): bool { $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/issues/' . $index . '/labels', 'DELETE'); return true; } /** * @param string $owner * @param string $repositoryName * @param int $index * @param int $id * @return bool */ public function deleteLabel(string $owner, string $repositoryName, int $index, int $id): bool { $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/issues/' . $index . '/labels/' . $id, 'DELETE'); return true; } /** * @param string $owner * @param string $repositoryName * @return array */ public function getRepositoryLabels(string $owner, string $repositoryName): array { $response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/labels'); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $id * @return array */ public function getRepositoryLabel(string $owner, string $repositoryName, int $id): array { $response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/labels/' . $id); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $id * @return array */ public function updateRepositoryLabel( string $owner, string $repositoryName, int $id, string $name = null, string $description = null, string $color = null ): array { $options['json'] = [ 'name' => $name, 'description' => $description, 'color' => $color, ]; $options['json'] = $this->removeNullValues($options['json']); $response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/labels/' . $id, 'PATCH', $options); return \GuzzleHttp\json_decode($response->getBody(), true); } /** * @param string $owner * @param string $repositoryName * @param int $id * @return bool */ public function deleteRepositoryLabel(string $owner, string $repositoryName, int $id): bool { $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/labels/' . $id, 'DELETE'); return true; } }