From c0f3e9a1cc3728d1ca0084f9bae913db664c0ad8 Mon Sep 17 00:00:00 2001 From: Vytas Dauksa Date: Fri, 11 Jun 2021 14:52:24 +0100 Subject: [PATCH 1/2] Add basic support to retrieve labels --- src/Atlassian.Stash/Api/Labels.cs | 66 +++++++++++++++++++ src/Atlassian.Stash/Entities/Label.cs | 10 +++ .../Entities/LabelRepository.cs | 17 +++++ src/Atlassian.Stash/StashClient.cs | 3 + .../StashClientTester.cs | 15 ++++- 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 src/Atlassian.Stash/Api/Labels.cs create mode 100644 src/Atlassian.Stash/Entities/Label.cs create mode 100644 src/Atlassian.Stash/Entities/LabelRepository.cs diff --git a/src/Atlassian.Stash/Api/Labels.cs b/src/Atlassian.Stash/Api/Labels.cs new file mode 100644 index 0000000..0ecfacd --- /dev/null +++ b/src/Atlassian.Stash/Api/Labels.cs @@ -0,0 +1,66 @@ +using System.Threading.Tasks; +using Atlassian.Stash.Entities; +using Atlassian.Stash.Helpers; +using Atlassian.Stash.Workers; + +namespace Atlassian.Stash.Api +{ + public class Labels + { + private const string MANY_LABELS = "rest/api/1.0/labels"; + private const string ONE_LABEL = "rest/api/1.0/labels/{0}"; + private const string LABELED_REPOSITORY = "rest/api/1.0/labels/{0}/labeled"; + + private HttpCommunicationWorker _httpWorker; + + internal Labels(HttpCommunicationWorker httpWorker) + { + _httpWorker = httpWorker; + } + + public async Task> Get(RequestOptions requestOptions = null) + { + string requestUrl = UrlBuilder.FormatRestApiUrl(MANY_LABELS, requestOptions); + + ResponseWrapper