Skip to content

Commit

Permalink
Change GetNotesAsync() issueid and mergerequestid to long (#38)
Browse files Browse the repository at this point in the history
* Revert "mergeRequestIid to long (#37)"

This reverts commit 3353de7.

* Revert "Assignees to long[] (#36)"

This reverts commit b6fc83b.

* Revert "Merge pull request #35 from apiiro/snir/long-ids"

This reverts commit 9a466e7, reversing
changes made to fc8b930.

* int -> long

* Update GitLabApiClient.csproj
  • Loading branch information
snirburkush authored Oct 15, 2024
1 parent 3353de7 commit 2ef17ae
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/GitLabApiClient/GitLabApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<LangVersion>10</LangVersion>
<PackageId>Apiiro.GitLabApiClient</PackageId>
<Version>0.1.37</Version>
<Version>0.1.38</Version>
<Authors>Apiiro</Authors>
<Company>Apiiro</Company>
<PackageDescription>GitLabApiClient</PackageDescription>
Expand Down
5 changes: 2 additions & 3 deletions src/GitLabApiClient/GroupsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public async Task<IList<Milestone>> GetMilestonesAsync(GroupId groupId, Action<M
/// </summary>
/// <param name="groupId">The ID, path or <see cref="Group"/> of the group.</param>
/// <param name="milestoneId">Id of the milestone.</param>
public async Task<Milestone> GetMilestoneAsync(GroupId groupId, long milestoneId) =>
public async Task<Milestone> GetMilestoneAsync(GroupId groupId, int milestoneId) =>
await _httpFacade.Get<Milestone>($"groups/{groupId}/milestones/{milestoneId}");

/// <summary>
Expand Down Expand Up @@ -241,8 +241,7 @@ public async Task<Group> UpdateAsync(GroupId groupId, UpdateGroupRequest request
/// <param name="milestoneId">The ID of the group's milestone.</param>
/// <param name="request">Update milestone request.</param>
/// <returns>Newly modified milestone.</returns>
public async Task<Milestone> UpdateMilestoneAsync(GroupId groupId, long milestoneId,
UpdateGroupMilestoneRequest request)
public async Task<Milestone> UpdateMilestoneAsync(GroupId groupId, int milestoneId, UpdateGroupMilestoneRequest request)
{
Guard.NotNull(request, nameof(request));
return await _httpFacade.Put<Milestone>($"groups/{groupId}/milestones/{milestoneId}", request);
Expand Down
4 changes: 2 additions & 2 deletions src/GitLabApiClient/IGroupsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public interface IGroupsClient
/// </summary>
/// <param name="groupId">The ID, path or <see cref="Group"/> of the group.</param>
/// <param name="milestoneId">Id of the milestone.</param>
Task<Milestone> GetMilestoneAsync(GroupId groupId, long milestoneId);
Task<Milestone> GetMilestoneAsync(GroupId groupId, int milestoneId);

/// <summary>
/// Get a list of runners in a group.
Expand Down Expand Up @@ -150,7 +150,7 @@ public interface IGroupsClient
/// <param name="milestoneId">The ID of the group's milestone.</param>
/// <param name="request">Update milestone request.</param>
/// <returns>Newly modified milestone.</returns>
Task<Milestone> UpdateMilestoneAsync(GroupId groupId, long milestoneId, UpdateGroupMilestoneRequest request);
Task<Milestone> UpdateMilestoneAsync(GroupId groupId, int milestoneId, UpdateGroupMilestoneRequest request);

/// <summary>
/// Removes group with all projects inside.
Expand Down
10 changes: 5 additions & 5 deletions src/GitLabApiClient/IIssuesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface IIssuesClient
/// <summary>
/// Retrieves project issue.
/// </summary>
Task<Issue> GetAsync(ProjectId projectId, long issueId);
Task<Issue> GetAsync(ProjectId projectId, int issueId);

/// <summary>
/// Retrieves issues from a project.
Expand Down Expand Up @@ -81,7 +81,7 @@ public interface IIssuesClient
/// <param name="issueIid">Iid of the issue.</param>
/// <param name="noteId">Id of the note.</param>
/// <returns>Issues satisfying options.</returns>
Task<Note> GetNoteAsync(ProjectId projectId, long issueIid, long noteId);
Task<Note> GetNoteAsync(ProjectId projectId, int issueIid, int noteId);

/// <summary>
/// Retrieves notes (comments) of an issue.
Expand All @@ -108,7 +108,7 @@ Task<IList<Note>> GetNotesAsync(ProjectId projectId, long issueIid,
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="request">Create issue note request.</param>
Task<Note> CreateNoteAsync(ProjectId projectId, long issueIid, CreateIssueNoteRequest request);
Task<Note> CreateNoteAsync(ProjectId projectId, int issueIid, CreateIssueNoteRequest request);

/// <summary>
/// Updated existing issue.
Expand All @@ -117,7 +117,7 @@ Task<IList<Note>> GetNotesAsync(ProjectId projectId, long issueIid,
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="request">Update issue request.</param>
Task<Issue> UpdateAsync(ProjectId projectId, long issueIid, UpdateIssueRequest request);
Task<Issue> UpdateAsync(ProjectId projectId, int issueIid, UpdateIssueRequest request);

/// <summary>
/// Modify existing note (comment) of an issue.
Expand All @@ -127,7 +127,7 @@ Task<IList<Note>> GetNotesAsync(ProjectId projectId, long issueIid,
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="noteId">The ID of a note.</param>
/// <param name="request">Update issue note request.</param>
Task<Note> UpdateNoteAsync(ProjectId projectId, long issueIid, long noteId, UpdateIssueNoteRequest request);
Task<Note> UpdateNoteAsync(ProjectId projectId, int issueIid, int noteId, UpdateIssueNoteRequest request);

/// <summary>
/// Deletes an existing note (comment) of an issue.
Expand Down
14 changes: 7 additions & 7 deletions src/GitLabApiClient/IMergeRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,23 @@ public interface IMergeRequestsClient
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
/// <param name="request">Update Merge request.</param>
Task<MergeRequest> UpdateAsync(ProjectId projectId, long mergeRequestId, UpdateMergeRequest request);
Task<MergeRequest> UpdateAsync(ProjectId projectId, int mergeRequestId, UpdateMergeRequest request);

/// <summary>
/// Accepts merge request.
/// </summary>
/// <returns>The accepted merge request.</returns>
/// ///
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
/// <param name="request">Accept Merge request.</param>
Task<MergeRequest> AcceptAsync(ProjectId projectId, long mergeRequestId, AcceptMergeRequest request);
Task<MergeRequest> AcceptAsync(ProjectId projectId, int mergeRequestId, AcceptMergeRequest request);

/// <summary>
/// Deletes merge request.
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
Task DeleteAsync(ProjectId projectId, long mergeRequestId);
Task DeleteAsync(ProjectId projectId, int mergeRequestId);

/// <summary>
/// Creates a new note (comment) to a single Merge Request.
Expand All @@ -90,7 +89,8 @@ public interface IMergeRequestsClient
/// <param name="mergeRequestIid">Iid of the merge request.</param>
/// <param name="options">MergeRequestNotes retrieval options.</param>
/// <returns>Merge requests satisfying options.</returns>
Task<IList<Note>> GetNotesAsync(ProjectId projectId, int mergeRequestIid, Action<MergeRequestNotesQueryOptions> options = null);
Task<IList<Note>> GetNotesAsync(ProjectId projectId, long mergeRequestIid,
Action<MergeRequestNotesQueryOptions> options = null);

/// <summary>
/// List erge request pipelines
Expand Down Expand Up @@ -119,6 +119,6 @@ public interface IMergeRequestsClient
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
Task<IList<MergeRequestDiffVersion>> GetDiffVersionsAsync(ProjectId projectId, long mergeRequestIid);
Task<IList<MergeRequestDiffVersion>> GetDiffVersionsAsync(ProjectId projectId, int mergeRequestIid);
}
}
5 changes: 2 additions & 3 deletions src/GitLabApiClient/IProjectsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public interface IProjectsClient
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="milestoneId">Id of the milestone.</param>
Task<Milestone> GetMilestoneAsync(ProjectId projectId, long milestoneId);
Task<Milestone> GetMilestoneAsync(ProjectId projectId, int milestoneId);

/// <summary>
/// Get the runners list of a project.
Expand Down Expand Up @@ -159,8 +159,7 @@ public interface IProjectsClient
/// <param name="milestoneId">The ID of a project milestone.</param>
/// <param name="request">Update milestone request.</param>
/// <returns>Newly modified milestone.</returns>
Task<Milestone> UpdateMilestoneAsync(ProjectId projectId, long milestoneId,
UpdateProjectMilestoneRequest request);
Task<Milestone> UpdateMilestoneAsync(ProjectId projectId, int milestoneId, UpdateProjectMilestoneRequest request);

/// <summary>
/// Updates an existing project variable.
Expand Down
6 changes: 3 additions & 3 deletions src/GitLabApiClient/IRunnersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public interface IRunnersClient
/// </summary>
/// <param name="runnerId">Id of the runner.</param>
/// <returns>Runner or NULL if it was not found.</returns>
Task<RunnerDetails> GetAsync(long runnerId);
Task<RunnerDetails> GetAsync(int runnerId);

/// <summary>
/// Updates existing runner
/// </summary>
/// <param name="runnerId">Id of the runner.</param>
/// <param name="request">Request to update runner.</param>
/// <returns>Newly modified runner.</returns>
Task<Runner> UpdateAsync(long runnerId, UpdateRunnerRequest request);
Task<Runner> UpdateAsync(int runnerId, UpdateRunnerRequest request);

/// <summary>
/// Creates a new runner registration.
Expand All @@ -43,7 +43,7 @@ public interface IRunnersClient
/// Deletes a runner.
/// </summary>
/// <param name="runnerId">Id of the runner.</param>
Task DeleteAsync(long runnerId);
Task DeleteAsync(int runnerId);

/// <summary>
/// Deletes a runner.
Expand Down
4 changes: 2 additions & 2 deletions src/GitLabApiClient/Internal/Paths/GroupId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static implicit operator GroupId(string groupPath)
return new GroupId(groupPath.UrlEncode());
}

public static implicit operator GroupId(long groupId)
public static implicit operator GroupId(int groupId)
{
return new GroupId(groupId.ToString());
}
Expand All @@ -31,7 +31,7 @@ public static implicit operator GroupId(Group group)
if (!string.IsNullOrEmpty(groupPath))
return new GroupId(groupPath.UrlEncode());

long id = group.Id;
int id = group.Id;
if (id > 0)
return new GroupId(id.ToString());

Expand Down
4 changes: 2 additions & 2 deletions src/GitLabApiClient/Internal/Paths/ProjectId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static implicit operator ProjectId(string projectPath)
return new ProjectId(projectPath.UrlEncode());
}

public static implicit operator ProjectId(long projectId)
public static implicit operator ProjectId(int projectId)
{
return new ProjectId(projectId.ToString());
}
Expand All @@ -31,7 +31,7 @@ public static implicit operator ProjectId(Project project)
if (!string.IsNullOrEmpty(projectPath))
return new ProjectId(projectPath.UrlEncode());

long id = project.Id;
int id = project.Id;
if (id > 0)
return new ProjectId(id.ToString());

Expand Down
2 changes: 1 addition & 1 deletion src/GitLabApiClient/Internal/Paths/UserId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static implicit operator UserId(int userId)

public static implicit operator UserId(User user)
{
long id = user.Id;
int id = user.Id;
if (id > 0)
return new UserId(id.ToString());

Expand Down
4 changes: 2 additions & 2 deletions src/GitLabApiClient/Internal/Queries/QueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void Add(string name, IList<int> values)
Add($"{name}[]", val.ToString());
}

public void Add(IList<long> values)
public void Add(IList<int> values)
{
foreach (long iid in values)
foreach (int iid in values)
Add("iids[]", iid.ToString());
}

Expand Down
11 changes: 5 additions & 6 deletions src/GitLabApiClient/IssuesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task<IList<Issue>> GetAllAsync(ProjectId projectId = null, GroupId
/// <summary>
/// Retrieves project issue.
/// </summary>
public async Task<Issue> GetAsync(ProjectId projectId, long issueId) =>
public async Task<Issue> GetAsync(ProjectId projectId, int issueId) =>
await _httpFacade.Get<Issue>($"projects/{projectId}/issues/{issueId}");

/// <summary>
Expand Down Expand Up @@ -128,7 +128,7 @@ public Task<IList<Issue>> GetAsync(Action<IssuesQueryOptions> options = null) =>
/// <param name="issueIid">Iid of the issue.</param>
/// <param name="noteId">Id of the note.</param>
/// <returns>Issues satisfying options.</returns>
public async Task<Note> GetNoteAsync(ProjectId projectId, long issueIid, long noteId) =>
public async Task<Note> GetNoteAsync(ProjectId projectId, int issueIid, int noteId) =>
await _httpFacade.Get<Note>($"projects/{projectId}/issues/{issueIid}/notes/{noteId}");

/// <summary>
Expand Down Expand Up @@ -164,7 +164,7 @@ public async Task<Issue> CreateAsync(ProjectId projectId, CreateIssueRequest req
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="request">Create issue note request.</param>
public async Task<Note> CreateNoteAsync(ProjectId projectId, long issueIid, CreateIssueNoteRequest request) =>
public async Task<Note> CreateNoteAsync(ProjectId projectId, int issueIid, CreateIssueNoteRequest request) =>
await _httpFacade.Post<Note>($"projects/{projectId}/issues/{issueIid}/notes", request);

/// <summary>
Expand All @@ -174,7 +174,7 @@ public async Task<Note> CreateNoteAsync(ProjectId projectId, long issueIid, Crea
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="request">Update issue request.</param>
public async Task<Issue> UpdateAsync(ProjectId projectId, long issueIid, UpdateIssueRequest request) =>
public async Task<Issue> UpdateAsync(ProjectId projectId, int issueIid, UpdateIssueRequest request) =>
await _httpFacade.Put<Issue>($"projects/{projectId}/issues/{issueIid}", request);

/// <summary>
Expand All @@ -185,8 +185,7 @@ public async Task<Issue> UpdateAsync(ProjectId projectId, long issueIid, UpdateI
/// <param name="issueIid">The IID of an issue.</param>
/// <param name="noteId">The ID of a note.</param>
/// <param name="request">Update issue note request.</param>
public async Task<Note> UpdateNoteAsync(ProjectId projectId, long issueIid, long noteId,
UpdateIssueNoteRequest request) =>
public async Task<Note> UpdateNoteAsync(ProjectId projectId, int issueIid, int noteId, UpdateIssueNoteRequest request) =>
await _httpFacade.Put<Note>($"projects/{projectId}/issues/{issueIid}/notes/{noteId}", request);

/// <summary>
Expand Down
16 changes: 7 additions & 9 deletions src/GitLabApiClient/MergeRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,17 @@ public async Task<MergeRequest> CreateAsync(ProjectId projectId, CreateMergeRequ
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
/// <param name="request">Update Merge request.</param>
public async Task<MergeRequest> UpdateAsync(ProjectId projectId, long mergeRequestId,
UpdateMergeRequest request) =>
public async Task<MergeRequest> UpdateAsync(ProjectId projectId, int mergeRequestId, UpdateMergeRequest request) =>
await _httpFacade.Put<MergeRequest>($"projects/{projectId}/merge_requests/{mergeRequestId}", request);

/// <summary>
/// Accepts merge request.
/// </summary>
/// <returns>The accepted merge request.</returns>
/// ///
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
/// <param name="request">Accept Merge request.</param>
public async Task<MergeRequest> AcceptAsync(ProjectId projectId, long mergeRequestId,
AcceptMergeRequest request)
public async Task<MergeRequest> AcceptAsync(ProjectId projectId, int mergeRequestId, AcceptMergeRequest request)
{
return await _httpFacade.Put<MergeRequest>(
$"projects/{projectId}/merge_requests/{mergeRequestId}/merge", request);
Expand All @@ -124,7 +121,7 @@ public async Task<MergeRequest> AcceptAsync(ProjectId projectId, long mergeReque
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestId">The Internal Merge Request Id.</param>
public async Task DeleteAsync(ProjectId projectId, long mergeRequestId) =>
public async Task DeleteAsync(ProjectId projectId, int mergeRequestId) =>
await _httpFacade.Delete($"projects/{projectId}/merge_requests/{mergeRequestId}");

/// <summary>
Expand All @@ -144,7 +141,8 @@ public async Task<Note> CreateNoteAsync(ProjectId projectId, int mergeRequestId,
/// <param name="mergeRequestIid">Iid of the merge request.</param>
/// <param name="options">MergeRequestNotes retrieval options.</param>
/// <returns>Merge requests satisfying options.</returns>
public async Task<IList<Note>> GetNotesAsync(ProjectId projectId, int mergeRequestIid, Action<MergeRequestNotesQueryOptions> options = null)
public async Task<IList<Note>> GetNotesAsync(ProjectId projectId, long mergeRequestIid,
Action<MergeRequestNotesQueryOptions> options = null)
{
var queryOptions = new MergeRequestNotesQueryOptions();
options?.Invoke(queryOptions);
Expand Down Expand Up @@ -183,7 +181,7 @@ public async Task<IList<AwardEmoji>> GetAwardEmojisAsync(ProjectId projectId, in
/// </summary>
/// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
/// <param name="mergeRequestIid">The Internal Merge Request Id.</param>
public async Task<IList<MergeRequestDiffVersion>> GetDiffVersionsAsync(ProjectId projectId, long mergeRequestIid) =>
public async Task<IList<MergeRequestDiffVersion>> GetDiffVersionsAsync(ProjectId projectId, int mergeRequestIid) =>
await _httpFacade.GetPagedList<MergeRequestDiffVersion>($"projects/{projectId}/merge_requests/{mergeRequestIid}/versions");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class AwardEmoji
public DateTime UpdatedAt { get; set; }

[JsonProperty("awardable_id")]
public long AwardableId { get; set; }
public int AwardableId { get; set; }

[JsonProperty("awardable_type")]
public AwardableType AwardableType { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/GitLabApiClient/Models/Groups/Responses/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace GitLabApiClient.Models.Groups.Responses
public sealed class Group
{
[JsonProperty("id")]
public long Id { get; set; }
public int Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public CreateIssueRequest(string title)
/// The IDs of the users to assign issue.
/// </summary>
[JsonProperty("assignee_ids")]
public List<long> Assignees { get; set; } = new List<long>();
public List<int> Assignees { get; set; } = new List<int>();

/// <summary>
/// The ID of a milestone to assign issue.
Expand Down
Loading

0 comments on commit 2ef17ae

Please sign in to comment.