From def2baa87c846a70ba475bff545aa739c91fc2cf Mon Sep 17 00:00:00 2001 From: Gert-Jan Hommersom Date: Mon, 10 May 2021 15:57:09 +0200 Subject: [PATCH 1/3] Fixed pipelines url --- .../v2/Repositories/Pipelines/BitbucketCloudClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs b/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs index 0d65f9f..295e42e 100644 --- a/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs +++ b/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs @@ -11,13 +11,13 @@ namespace Bitbucket.Cloud.Net { public partial class BitbucketCloudClient { - private IFlurlRequest GetPipelinesUrl(string workspaceId, string repositorySlug) => GetBaseUrl($"2.0/repositories/{workspaceId}/{repositorySlug}/pipelines"); + private IFlurlRequest GetPipelinesUrl(string workspaceId, string repositorySlug) => GetBaseUrl($"2.0/repositories/{workspaceId}/{repositorySlug}/pipelines/"); private IFlurlRequest GetPipelinesUrl(string workspaceId, string repositorySlug, Guid pipelineUuid) => GetPipelinesUrl(workspaceId, repositorySlug) - .AppendPathSegment($"/pipelines/{pipelineUuid:B}"); + .AppendPathSegment($"/{pipelineUuid:B}"); private IFlurlRequest GetPipelineStepsUrl(string workspaceId, string repositorySlug, Guid pipelineUuid) => GetPipelinesUrl(workspaceId, repositorySlug, pipelineUuid) - .AppendPathSegment("/steps"); + .AppendPathSegment("/steps/"); private IFlurlRequest GetPipelineStepUrl(string workspaceId, string repositorySlug, Guid pipelineUuid, string stepId) => GetPipelineStepsUrl(workspaceId, repositorySlug, pipelineUuid) .AppendPathSegment($"/{stepId}"); From 0def4a17d5f85aaf620c3adaf6829161da098de5 Mon Sep 17 00:00:00 2001 From: Gert-Jan Hommersom Date: Mon, 10 May 2021 16:04:33 +0200 Subject: [PATCH 2/3] Added support for page, pageLength and sorting to GetRepositoryPipelinesAsync --- .../v2/Repositories/Pipelines/BitbucketCloudClient.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs b/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs index 295e42e..5706718 100644 --- a/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs +++ b/src/Bitbucket.Cloud.Net/v2/Repositories/Pipelines/BitbucketCloudClient.cs @@ -22,9 +22,14 @@ private IFlurlRequest GetPipelineStepsUrl(string workspaceId, string repositoryS private IFlurlRequest GetPipelineStepUrl(string workspaceId, string repositorySlug, Guid pipelineUuid, string stepId) => GetPipelineStepsUrl(workspaceId, repositorySlug, pipelineUuid) .AppendPathSegment($"/{stepId}"); - public async Task> GetRepositoryPipelinesAsync(string workspaceId, string repositorySlug, int? maxPages = null) + public async Task> GetRepositoryPipelinesAsync(string workspaceId, string repositorySlug, int? maxPages = null, int? page = null, int? pageLength = null, string sort = null) { - var queryParamValues = new Dictionary(); + var queryParamValues = new Dictionary + { + [nameof(page)] = page, + ["pagelen"] = pageLength, + [nameof(sort)] = sort + }; return await GetPagedResultsAsync(maxPages, queryParamValues, async qpv => await GetPipelinesUrl(workspaceId, repositorySlug) From 2ad576d5524525dc91513d077ca3c088f27d6dce Mon Sep 17 00:00:00 2001 From: Gert-Jan Hommersom Date: Mon, 10 May 2021 16:44:22 +0200 Subject: [PATCH 3/3] Added missing properties to Target model --- src/Bitbucket.Cloud.Net/Models/v2/Target.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Bitbucket.Cloud.Net/Models/v2/Target.cs b/src/Bitbucket.Cloud.Net/Models/v2/Target.cs index 04ba22a..a538cb7 100644 --- a/src/Bitbucket.Cloud.Net/Models/v2/Target.cs +++ b/src/Bitbucket.Cloud.Net/Models/v2/Target.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Bitbucket.Cloud.Net.Models.v2 { @@ -13,5 +14,10 @@ public class Target public DateTime Date { get; set; } public string Message { get; set; } public string Type { get; set; } + + [JsonProperty("ref_type")] public string RefType { get; set; } + [JsonProperty("ref_name")] public string RefName { get; set; } + + public string Source { get; set; } } } \ No newline at end of file