Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-z committed Dec 13, 2024
1 parent adc46e2 commit ba7efbc
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 236 deletions.
2 changes: 1 addition & 1 deletion NGitLab.Mock/Clients/ClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected Project GetProject(object id, ProjectPermission permissions)

var project = id switch
{
int idInt => Server.AllProjects.FindById(idInt),
long idLong => Server.AllProjects.FindById(idLong),
string idStr => Server.AllProjects.FindProject(idStr),
IIdOrPathAddressable pid when pid.Path != null => Server.AllProjects.FindByNamespacedPath(pid.Path),
IIdOrPathAddressable pid => Server.AllProjects.FindById(pid.Id),
Expand Down
46 changes: 0 additions & 46 deletions NGitLab.Mock/Clients/GitLabClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public GitLabClient(ClientContext context)

public IMembersClient Members => new MembersClient(Context);

public ICommitClient GetCommits(long projectId) => GetCommits((long)projectId);

public ICommitClient GetCommits(ProjectId projectId) => new CommitClient(Context, projectId);

public IIssueClient Issues => new IssueClient(Context);
Expand Down Expand Up @@ -60,99 +58,55 @@ public IGraphQLClient GraphQL

public IEventClient GetUserEvents(long userId) => new EventClient(Context, userId);

public IEventClient GetProjectEvents(long projectId) => GetProjectEvents((long)projectId);

public IEventClient GetProjectEvents(ProjectId projectId) => new EventClient(Context, null, projectId);

public ICommitStatusClient GetCommitStatus(long projectId) => GetCommitStatus((long)projectId);

public ICommitStatusClient GetCommitStatus(ProjectId projectId) => new CommitStatusClient(Context, projectId);

public IEnvironmentClient GetEnvironmentClient(long projectId) => GetEnvironmentClient((long)projectId);

public IEnvironmentClient GetEnvironmentClient(ProjectId projectId) => new EnvironmentClient(Context, projectId);

public IClusterClient GetClusterClient(long projectId) => GetClusterClient((long)projectId);

public IClusterClient GetClusterClient(ProjectId projectId) => new ClusterClient(Context, projectId);

public IGroupBadgeClient GetGroupBadgeClient(long groupId) => GetGroupBadgeClient((long)groupId);

public IGroupBadgeClient GetGroupBadgeClient(GroupId groupId) => new GroupBadgeClient(Context, groupId);

public IGroupVariableClient GetGroupVariableClient(long groupId) => GetGroupVariableClient((long)groupId);

public IGroupVariableClient GetGroupVariableClient(GroupId groupId) => new GroupVariableClient(Context, groupId);

public IJobClient GetJobs(long projectId) => GetJobs((long)projectId);

public IJobClient GetJobs(ProjectId projectId) => new JobClient(Context, projectId);

public IMergeRequestClient GetMergeRequest(long projectId) => GetMergeRequest((long)projectId);

public IMergeRequestClient GetMergeRequest(ProjectId projectId) => new MergeRequestClient(Context, projectId);

public IMergeRequestClient GetGroupMergeRequest(GroupId groupId) => new MergeRequestClient(Context, groupId);

public IMilestoneClient GetMilestone(long projectId) => GetMilestone((long)projectId);

public IMilestoneClient GetMilestone(ProjectId projectId) => new MilestoneClient(Context, projectId, MilestoneScope.Projects);

public IMilestoneClient GetGroupMilestone(long groupId) => GetGroupMilestone((long)groupId);

public IMilestoneClient GetGroupMilestone(GroupId groupId) => new MilestoneClient(Context, groupId, MilestoneScope.Groups);

public IReleaseClient GetReleases(long projectId) => GetReleases((long)projectId);

public IReleaseClient GetReleases(ProjectId projectId) => new ReleaseClient(Context, projectId);

public IPipelineClient GetPipelines(long projectId) => GetPipelines((long)projectId);

public IPipelineClient GetPipelines(ProjectId projectId) => new PipelineClient(Context, jobClient: GetJobs(projectId), projectId: projectId);

public IPipelineScheduleClient GetPipelineSchedules(ProjectId projectId)
=> new PipelineScheduleClient(Context, projectId);

public IProjectBadgeClient GetProjectBadgeClient(long projectId) => GetProjectBadgeClient((long)projectId);

public IProjectBadgeClient GetProjectBadgeClient(ProjectId projectId) => new ProjectBadgeClient(Context, projectId);

public IProjectIssueNoteClient GetProjectIssueNoteClient(long projectId) => GetProjectIssueNoteClient((long)projectId);

public IProjectIssueNoteClient GetProjectIssueNoteClient(ProjectId projectId) => new ProjectIssueNoteClient(Context, projectId);

public IProjectVariableClient GetProjectVariableClient(long projectId) => GetProjectVariableClient((long)projectId);

public IProjectVariableClient GetProjectVariableClient(ProjectId projectId) => new ProjectVariableClient(Context, projectId);

public IRepositoryClient GetRepository(long projectId) => GetRepository((long)projectId);

public IRepositoryClient GetRepository(ProjectId projectId) => new RepositoryClient(Context, projectId);

public ITriggerClient GetTriggers(long projectId) => GetTriggers((long)projectId);

public ITriggerClient GetTriggers(ProjectId projectId) => new TriggerClient(Context, projectId);

public IWikiClient GetWikiClient(long projectId) => GetWikiClient((long)projectId);

public IWikiClient GetWikiClient(ProjectId projectId) => new WikiClient(Context, projectId);

public IProjectLevelApprovalRulesClient GetProjectLevelApprovalRulesClient(long projectId) => GetProjectLevelApprovalRulesClient((long)projectId);

public IProjectLevelApprovalRulesClient GetProjectLevelApprovalRulesClient(ProjectId projectId) => new ProjectLevelApprovalRulesClient(Context, projectId);

public IProtectedBranchClient GetProtectedBranchClient(long projectId) => GetProtectedBranchClient((long)projectId);

public IProtectedBranchClient GetProtectedBranchClient(ProjectId projectId) => new ProtectedBranchClient(Context, projectId);

public IProtectedTagClient GetProtectedTagClient(ProjectId projectId) => new ProtectedTagClient(Context, projectId);

public ISearchClient GetGroupSearchClient(long groupId) => GetGroupSearchClient((long)groupId);

public ISearchClient GetGroupSearchClient(GroupId groupId) => new GroupSearchClient(Context, groupId);

public ISearchClient GetProjectSearchClient(long projectId) => GetProjectSearchClient((long)projectId);

public ISearchClient GetProjectSearchClient(ProjectId projectId) => new ProjectSearchClient(Context, projectId);

public IGroupHooksClient GetGroupHooksClient(GroupId groupId) => new GroupHooksClient(Context, groupId);
Expand Down
69 changes: 0 additions & 69 deletions NGitLab/GitLabClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,150 +108,81 @@ public IEventClient GetEvents()
public IEventClient GetUserEvents(long userId)
=> new EventClient(_api, $"users/{userId.ToStringInvariant()}/events");

public IEventClient GetProjectEvents(long projectId)
=> GetProjectEvents((long)projectId);

public IEventClient GetProjectEvents(ProjectId projectId)
=> new EventClient(_api, $"projects/{projectId.ValueAsUriParameter()}/events");

public IRepositoryClient GetRepository(long projectId)
=> GetRepository((long)projectId);

public IRepositoryClient GetRepository(ProjectId projectId)
=> new RepositoryClient(_api, projectId);

public ICommitClient GetCommits(long projectId)
=> GetCommits((long)projectId);

public ICommitClient GetCommits(ProjectId projectId)
=> new CommitClient(_api, projectId);

public ICommitStatusClient GetCommitStatus(long projectId)
=> GetCommitStatus((long)projectId);

public ICommitStatusClient GetCommitStatus(ProjectId projectId)
=> new CommitStatusClient(_api, projectId);

public IPipelineClient GetPipelines(long projectId)
=> GetPipelines((long)projectId);

public IPipelineClient GetPipelines(ProjectId projectId)
=> new PipelineClient(_api, projectId);

public IPipelineScheduleClient GetPipelineSchedules(ProjectId projectId)
=> new PipelineScheduleClient(_api, projectId);

public ITriggerClient GetTriggers(long projectId)
=> GetTriggers((long)projectId);

public ITriggerClient GetTriggers(ProjectId projectId)
=> new TriggerClient(_api, projectId);

public IJobClient GetJobs(long projectId)
=> GetJobs((long)projectId);

public IJobClient GetJobs(ProjectId projectId)
=> new JobClient(_api, projectId);

public IMergeRequestClient GetMergeRequest(long projectId)
=> GetMergeRequest((long)projectId);

public IMergeRequestClient GetMergeRequest(ProjectId projectId)
=> new MergeRequestClient(_api, projectId);

public IMergeRequestClient GetGroupMergeRequest(GroupId groupId)
=> new MergeRequestClient(_api, groupId);

public IMilestoneClient GetMilestone(long projectId)
=> GetMilestone((long)projectId);

public IMilestoneClient GetMilestone(ProjectId projectId)
=> new MilestoneClient(_api, MilestoneScope.Projects, projectId);

public IMilestoneClient GetGroupMilestone(long groupId)
=> GetGroupMilestone((long)groupId);

public IMilestoneClient GetGroupMilestone(GroupId groupId)
=> new MilestoneClient(_api, MilestoneScope.Groups, groupId);

public IReleaseClient GetReleases(long projectId)
=> GetReleases((long)projectId);

public IReleaseClient GetReleases(ProjectId projectId)
=> new ReleaseClient(_api, projectId);

public IProjectIssueNoteClient GetProjectIssueNoteClient(long projectId)
=> GetProjectIssueNoteClient((long)projectId);

public IProjectIssueNoteClient GetProjectIssueNoteClient(ProjectId projectId)
=> new ProjectIssueNoteClient(_api, projectId);

public IEnvironmentClient GetEnvironmentClient(long projectId)
=> GetEnvironmentClient((long)projectId);

public IEnvironmentClient GetEnvironmentClient(ProjectId projectId)
=> new EnvironmentClient(_api, projectId);

public IClusterClient GetClusterClient(long projectId)
=> GetClusterClient((long)projectId);

public IClusterClient GetClusterClient(ProjectId projectId)
=> new ClusterClient(_api, projectId);

public IWikiClient GetWikiClient(long projectId)
=> GetWikiClient((long)projectId);

public IWikiClient GetWikiClient(ProjectId projectId)
=> new WikiClient(_api, projectId);

public IProjectBadgeClient GetProjectBadgeClient(long projectId)
=> GetProjectBadgeClient((long)projectId);

public IProjectBadgeClient GetProjectBadgeClient(ProjectId projectId)
=> new ProjectBadgeClient(_api, projectId);

public IGroupBadgeClient GetGroupBadgeClient(long groupId)
=> GetGroupBadgeClient((long)groupId);

public IGroupBadgeClient GetGroupBadgeClient(GroupId groupId)
=> new GroupBadgeClient(_api, groupId);

public IProjectVariableClient GetProjectVariableClient(long projectId)
=> GetProjectVariableClient((long)projectId);

public IProjectVariableClient GetProjectVariableClient(ProjectId projectId)
=> new ProjectVariableClient(_api, projectId);

public IGroupVariableClient GetGroupVariableClient(long groupId)
=> GetGroupVariableClient((long)groupId);

public IGroupVariableClient GetGroupVariableClient(GroupId groupId)
=> new GroupVariableClient(_api, groupId);

public IProjectLevelApprovalRulesClient GetProjectLevelApprovalRulesClient(long projectId)
=> GetProjectLevelApprovalRulesClient((long)projectId);

public IProjectLevelApprovalRulesClient GetProjectLevelApprovalRulesClient(ProjectId projectId)
=> new ProjectLevelApprovalRulesClient(_api, projectId);

public IProtectedBranchClient GetProtectedBranchClient(long projectId)
=> GetProtectedBranchClient((long)projectId);

public IProtectedBranchClient GetProtectedBranchClient(ProjectId projectId)
=> new ProtectedBranchClient(_api, projectId);

public IProtectedTagClient GetProtectedTagClient(ProjectId projectId)
=> new ProtectedTagClient(_api, projectId);

public ISearchClient GetGroupSearchClient(long groupId)
=> GetGroupSearchClient((long)groupId);

public ISearchClient GetGroupSearchClient(GroupId groupId)
=> new SearchClient(_api, $"/groups/{groupId.ValueAsUriParameter()}/search");

public ISearchClient GetProjectSearchClient(long projectId)
=> GetProjectSearchClient((long)projectId);

public ISearchClient GetProjectSearchClient(ProjectId projectId)
=> new SearchClient(_api, $"/projects/{projectId.ValueAsUriParameter()}/search");

Expand Down
Loading

0 comments on commit ba7efbc

Please sign in to comment.