Skip to content

Added 'source' and ''tag_list' fields and fixed the type of the 'Id' field #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/GitLabApiClient/GitLabApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild >true</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

Expand Down
5 changes: 5 additions & 0 deletions src/GitLabApiClient/Internal/Queries/PipelineQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ protected override void BuildCore(Query query, PipelineQueryOptions options)
{
query.Add("username", options.TriggeredBy);
}

if (options.Source.HasValue)
{
query.Add("source", options.Source.ToLowerCaseString());
}
}

#endregion
Expand Down
6 changes: 5 additions & 1 deletion src/GitLabApiClient/Models/Job/Responses/Job.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using GitLabApiClient.Models.Commits.Responses;
using GitLabApiClient.Models.Pipelines.Responses;
using GitLabApiClient.Models.Runners.Responses;
Expand Down Expand Up @@ -28,7 +29,7 @@ public sealed class Job
public DateTime? FinishedAt { get; set; }

[JsonProperty("id")]
public int Id { get; set; }
public string Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
Expand Down Expand Up @@ -56,5 +57,8 @@ public sealed class Job

[JsonProperty("web_url")]
public string WebUrl { get; set; }

[JsonProperty("tag_list")]
public IList<string> TagList { get; set; }
}
}
36 changes: 36 additions & 0 deletions src/GitLabApiClient/Models/Pipelines/PipelineSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Runtime.Serialization;

namespace GitLabApiClient.Models.Pipelines
{
public enum PipelineSource
{
[EnumMember(Value = "push")]
Push,
[EnumMember(Value = "web")]
Web,
[EnumMember(Value = "trigger")]
Trigger,
[EnumMember(Value = "schedule")]
Schedule,
[EnumMember(Value = "api")]
Api,
[EnumMember(Value = "external")]
External,
[EnumMember(Value = "pipeline")]
Pipeline,
[EnumMember(Value = "chat")]
Chat,
[EnumMember(Value = "webide")]
Webide,
[EnumMember(Value = "merge_request_event")]
MergeRequestEvent,
[EnumMember(Value = "external_pull_request_event")]
ExternalPullRequestEvent,
[EnumMember(Value = "parent_pipeline")]
ParentPipeline,
[EnumMember(Value = "ondemand_dast_scan")]
OndemandDastScan,
[EnumMember(Value = "ondemand_dast_validation")]
OndemandDastValidation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@ internal PipelineQueryOptions() { }
/// The username of the user who triggered pipelines
/// </summary>
public string TriggeredBy { get; set; }

/// <summary>
/// How the pipeline was triggered
/// </summary>
public PipelineSource? Source { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ public class PipelineDetail

[JsonProperty("coverage")]
public string Coverage { get; set; }

[JsonProperty("source")]
public PipelineSource? Source { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public void NonDefaultQueryBuilt()
Status = PipelineStatus.Failed,
Scope = PipelineScope.Pending,
Order = PipelineOrder.UserId,
SortOrder = SortOrder.Ascending
SortOrder = SortOrder.Ascending,
Source = PipelineSource.MergeRequestEvent
});

query.Should().Be("https://https://gitlab.com/api/v4/pipelines?" +
Expand All @@ -34,7 +35,9 @@ public void NonDefaultQueryBuilt()
"&status=failed" +
"&scope=pending" +
"&order_by=user_id" +
"&sort=asc");
"&sort=asc" +
"&source=merge_request_event"
);
}
}
}