Skip to content

Commit

Permalink
MR Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mlemieuxlafontaine-ubi committed Oct 25, 2024
1 parent 91512d7 commit 57f860e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 57 deletions.
1 change: 1 addition & 0 deletions NGitLab.Mock/Clients/PipelineScheduleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NGitLab.Models;

namespace NGitLab.Mock.Clients;

internal class PipelineScheduleClient : ClientBase, IPipelineScheduleClient
{
private readonly ProjectId _projectId;
Expand Down
10 changes: 5 additions & 5 deletions NGitLab/IPipelineScheduleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ namespace NGitLab;
public interface IPipelineScheduleClient
{
/// <summary>
/// All the scheduled pipelines of the project
/// Gets all the pipeline schedules of the project
/// </summary>
IEnumerable<PipelineScheduleBasic> All { get; }

/// <summary>
/// Return the details of single schedule
/// Details of single schedule
/// </summary>
/// <param name="id">Schedule Id</param>
/// <returns></returns>
PipelineSchedule this[int id] { get; }

/// <summary>
/// Return the details of single schedule
/// Gets the details of single schedule
/// </summary>
/// <param name="id">Schedule Id</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PipelineSchedule> GetByIdAsync(int id, CancellationToken cancellationToken = default);

/// <summary>
/// All the scheduled pipelines of the project
/// Gets all the pipeline schedules of the project
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
GitLabCollectionResponse<PipelineScheduleBasic> GetAllAsync();

/// <summary>
/// Get all pipelines triggered by a pipeline schedule in a project.
/// Gets all pipelines triggered by a pipeline schedule in a project.
/// </summary>
/// <param name="id">Schedule Id</param>
/// <returns></returns>
Expand Down
6 changes: 2 additions & 4 deletions NGitLab/Impl/PipelineScheduleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ namespace NGitLab.Impl;
internal class PipelineScheduleClient : IPipelineScheduleClient
{
private readonly API _api;

private readonly string _projectPath;
private readonly string _schedulesPath;

public PipelineScheduleClient(API api, ProjectId projectId)
{
_api = api;
_projectPath = $"{Project.Url}/{projectId.ValueAsUriParameter()}";
_schedulesPath = $"{_projectPath}/pipeline_schedules";
var projectPath = $"{Project.Url}/{projectId.ValueAsUriParameter()}";
_schedulesPath = $"{projectPath}/pipeline_schedules";
}

public PipelineSchedule this[int id] => _api.Get().To<PipelineSchedule>($"{_schedulesPath}/{id.ToStringInvariant()}");
Expand Down
32 changes: 2 additions & 30 deletions NGitLab/Models/PipelineSchedule.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace NGitLab.Models;

public class PipelineSchedule
public class PipelineSchedule : PipelineScheduleBasic
{
[JsonPropertyName("id")]
public int Id { get; set; }

[JsonPropertyName("description")]
public string Description { get; set; }

[JsonPropertyName("ref")]
public string Ref { get; set; }

[JsonPropertyName("cron")]
public string Cron { get; set; }

[JsonPropertyName("next_run_at")]
public DateTime NextRunAt { get; set; }

[JsonPropertyName("active")]
public bool Active { get; set; }

[JsonPropertyName("created_at")]
public DateTime CreatedAt { get; set; }

[JsonPropertyName("updated_at")]
public DateTime UpdatedAt { get; set; }

[JsonPropertyName("last_pipeline")]
public PipelineBasic LastPipeline { get; set; }

[JsonPropertyName("owner")]
public User Owner { get; set; }

[JsonPropertyName("variables")]
public IEnumerable<PipelineVariable> Variables { get; set; }
}
18 changes: 0 additions & 18 deletions NGitLab/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2909,27 +2909,9 @@ NGitLab.Models.PipelineQuery.Username.set -> void
NGitLab.Models.PipelineQuery.YamlErrors.get -> bool?
NGitLab.Models.PipelineQuery.YamlErrors.set -> void
NGitLab.Models.PipelineSchedule
NGitLab.Models.PipelineSchedule.Active.get -> bool
NGitLab.Models.PipelineSchedule.Active.set -> void
NGitLab.Models.PipelineSchedule.CreatedAt.get -> System.DateTime
NGitLab.Models.PipelineSchedule.CreatedAt.set -> void
NGitLab.Models.PipelineSchedule.Cron.get -> string
NGitLab.Models.PipelineSchedule.Cron.set -> void
NGitLab.Models.PipelineSchedule.Description.get -> string
NGitLab.Models.PipelineSchedule.Description.set -> void
NGitLab.Models.PipelineSchedule.Id.get -> int
NGitLab.Models.PipelineSchedule.Id.set -> void
NGitLab.Models.PipelineSchedule.LastPipeline.get -> NGitLab.Models.PipelineBasic
NGitLab.Models.PipelineSchedule.LastPipeline.set -> void
NGitLab.Models.PipelineSchedule.NextRunAt.get -> System.DateTime
NGitLab.Models.PipelineSchedule.NextRunAt.set -> void
NGitLab.Models.PipelineSchedule.Owner.get -> NGitLab.Models.User
NGitLab.Models.PipelineSchedule.Owner.set -> void
NGitLab.Models.PipelineSchedule.PipelineSchedule() -> void
NGitLab.Models.PipelineSchedule.Ref.get -> string
NGitLab.Models.PipelineSchedule.Ref.set -> void
NGitLab.Models.PipelineSchedule.UpdatedAt.get -> System.DateTime
NGitLab.Models.PipelineSchedule.UpdatedAt.set -> void
NGitLab.Models.PipelineSchedule.Variables.get -> System.Collections.Generic.IEnumerable<NGitLab.Models.PipelineVariable>
NGitLab.Models.PipelineSchedule.Variables.set -> void
NGitLab.Models.PipelineScheduleBasic
Expand Down

0 comments on commit 57f860e

Please sign in to comment.