3535/** Reference Api client */
3636public class GitDataClient {
3737
38+ private static final String REFERENCE_URI = "/repos/%s/%s/git/refs/%s" ;
3839 private static final String BRANCH_REFERENCE_URI = "/repos/%s/%s/git/refs/heads/%s" ;
3940 private static final String TAG_REFERENCE_URI = "/repos/%s/%s/git/refs/tags/%s" ;
4041 private static final String TAG_URI = "/repos/%s/%s/git/tags/%s" ;
@@ -60,12 +61,30 @@ static GitDataClient create(final GitHubClient github, final String owner, final
6061 *
6162 * @param ref search parameters
6263 */
63- public CompletableFuture <Void > delete (final String ref ) {
64+ public CompletableFuture <Void > deleteReference (final String ref ) {
6465 final String path =
65- format (BRANCH_REFERENCE_URI , owner , repo , ref . replaceAll ( "refs/heads/" , "" ) );
66+ format (REFERENCE_URI , owner , repo , ref );
6667 return github .delete (path ).thenAccept (IGNORE_RESPONSE_CONSUMER );
6768 }
6869
70+ /**
71+ * Deletes a git branch.
72+ *
73+ * @param branch search parameters
74+ */
75+ public CompletableFuture <Void > deleteBranch (final String branch ) {
76+ return deleteReference ("refs/heads/" + branch .replaceAll ("refs/heads/" , "" ));
77+ }
78+
79+ /**
80+ * Deletes a git tag.
81+ *
82+ * @param tag search parameters
83+ */
84+ public CompletableFuture <Void > deleteTag (final String tag ) {
85+ return deleteReference ("refs/tags/" + tag .replaceAll ("refs/tags/" , "" ));
86+ }
87+
6988 /**
7089 * Get a git branch reference
7190 *
0 commit comments