Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-06-25 17:16:48 +0000
committerKevin Sawicki2012-06-25 17:16:48 +0000
commitd604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1 (patch)
tree050067c32f62c61bb6281e5615002847f619d6f4 /org.eclipse.egit.github.core/src
parentdbf1fb5cb319c71380a235239d4901042f9a6ee0 (diff)
downloadegit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.tar.gz
egit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.tar.xz
egit-github-d604f8f603fc53c4c18d8c7a961ff3ae75b2e9b1.zip
Add service support for editing a label
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.java27
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);
+ }
}

Back to the top