diff options
author | Kevin Sawicki | 2012-06-25 17:16:48 +0000 |
---|---|---|
committer | Kevin Sawicki | 2012-06-25 17:16:48 +0000 |
commit | d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1 (patch) | |
tree | 050067c32f62c61bb6281e5615002847f619d6f4 /org.eclipse.egit.github.core/src | |
parent | dbf1fb5cb319c71380a235239d4901042f9a6ee0 (diff) | |
download | egit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.tar.gz egit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.tar.xz egit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.zip |
Add service support for editing a label
Change-Id: I816837e62aa02788db53c6afc57b8dc4b839171e
Diffstat (limited to 'org.eclipse.egit.github.core/src')
-rw-r--r-- | org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java index 98499c32..957d988f 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java @@ -269,4 +269,31 @@ public class LabelService extends GitHubService { uri.append('/').append(label); client.delete(uri.toString()); } + + /** + * Edit the given label in the given repository + * + * @param repository + * @param label + * @return edited label + * @throws IOException + */ + public Label editLabel(IRepositoryIdProvider repository, Label label) + throws IOException { + String repoId = getId(repository); + if (label == null) + throw new IllegalArgumentException("Label cannot be null"); //$NON-NLS-1$ + String name = label.getName(); + if (name == null) + throw new IllegalArgumentException("Label name cannot be null"); //$NON-NLS-1$ + if (name.length() == 0) + throw new IllegalArgumentException("Label name cannot be empty"); //$NON-NLS-1$ + + StringBuilder uri = new StringBuilder(SEGMENT_REPOS); + uri.append('/').append(repoId); + uri.append(SEGMENT_LABELS); + uri.append('/').append(name); + + return client.post(uri.toString(), label, Label.class); + } } |