Skip to content

Commit 3af0b38

Browse files
committed
once more
1 parent 7094713 commit 3af0b38

File tree

5 files changed

+9
-159
lines changed

5 files changed

+9
-159
lines changed

NGitLab.Mock.Tests/LabelsMockTests.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void Test_labels_can_be_added_to_project()
3535
.BuildServer();
3636

3737
var client = server.CreateClient();
38-
client.Labels.Create(new LabelCreate { Id = 1, Name = "test1" });
38+
client.Labels.CreateProjectLabel(1, new ProjectLabelCreate { Name = "test1" });
3939
var labels = client.Labels.ForProject(1).ToArray();
4040

4141
Assert.That(labels, Has.Length.EqualTo(1), "Labels count is invalid");
@@ -52,7 +52,7 @@ public void Test_labels_can_be_edited_from_project()
5252
.BuildServer();
5353

5454
var client = server.CreateClient();
55-
client.Labels.Edit(new LabelEdit { Id = 1, Name = "test1", NewName = "test2" });
55+
client.Labels.EditProjectLabel(1, new ProjectLabelEdit { Name = "test1", NewName = "test2" });
5656
var labels = client.Labels.ForProject(1).ToArray();
5757

5858
Assert.That(labels, Has.Length.EqualTo(1), "Labels count is invalid");
@@ -69,7 +69,11 @@ public void Test_labels_can_be_deleted_from_project()
6969
.BuildServer();
7070

7171
var client = server.CreateClient();
72-
client.Labels.Delete(new LabelDelete { Id = 1, Name = "test1" });
72+
client.Labels.DeleteProjectLabel(1, new ProjectLabelDelete
73+
{
74+
Id = 1,
75+
Name = "test1",
76+
});
7377
var labels = client.Labels.ForProject(1).ToArray();
7478

7579
Assert.That(labels, Is.Empty, "Labels count is invalid");
@@ -102,7 +106,7 @@ public void Test_labels_can_be_added_to_group()
102106
.BuildServer();
103107

104108
var client = server.CreateClient();
105-
client.Labels.CreateGroupLabel(new LabelCreate { Id = 2, Name = "test1" });
109+
client.Labels.CreateGroupLabel(2, new GroupLabelCreate { Name = "test1" });
106110
var labels = client.Labels.ForGroup(2).ToArray();
107111

108112
Assert.That(labels, Has.Length.EqualTo(1), "Labels count is invalid");
@@ -119,7 +123,7 @@ public void Test_labels_can_be_edited_from_group()
119123
.BuildServer();
120124

121125
var client = server.CreateClient();
122-
client.Labels.EditGroupLabel(new LabelEdit { Id = 2, Name = "test1", NewName = "test2" });
126+
client.Labels.EditGroupLabel(2, new GroupLabelEdit { Name = "test1", NewName = "test2" });
123127
var labels = client.Labels.ForGroup(2).ToArray();
124128

125129
Assert.That(labels, Has.Length.EqualTo(1), "Labels count is invalid");

NGitLab.Mock/Clients/LabelClient.cs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ public Models.Label CreateProjectLabel(long projectId, ProjectLabelCreate label)
2222
}
2323
}
2424

25-
[EditorBrowsable(EditorBrowsableState.Never)]
26-
public Models.Label Create(LabelCreate label)
27-
{
28-
return CreateProjectLabel(label.Id, new ProjectLabelCreate
29-
{
30-
Name = label.Name,
31-
Color = label.Color,
32-
Description = label.Description,
33-
});
34-
}
35-
3625
public Models.Label CreateGroupLabel(long groupId, GroupLabelCreate label)
3726
{
3827
using (Context.BeginOperationScope())
@@ -42,17 +31,6 @@ public Models.Label CreateGroupLabel(long groupId, GroupLabelCreate label)
4231
}
4332
}
4433

45-
[EditorBrowsable(EditorBrowsableState.Never)]
46-
public Models.Label CreateGroupLabel(LabelCreate label)
47-
{
48-
return CreateGroupLabel(label.Id, new GroupLabelCreate
49-
{
50-
Name = label.Name,
51-
Color = label.Color,
52-
Description = label.Description,
53-
});
54-
}
55-
5634
public Models.Label DeleteProjectLabel(long projectId, ProjectLabelDelete label)
5735
{
5836
using (Context.BeginOperationScope())
@@ -64,16 +42,6 @@ public Models.Label DeleteProjectLabel(long projectId, ProjectLabelDelete label)
6442
}
6543
}
6644

67-
[EditorBrowsable(EditorBrowsableState.Never)]
68-
public Models.Label Delete(LabelDelete label)
69-
{
70-
return DeleteProjectLabel(label.Id, new ProjectLabelDelete
71-
{
72-
Id = label.Id,
73-
Name = label.Name,
74-
});
75-
}
76-
7745
public Models.Label EditProjectLabel(long projectId, ProjectLabelEdit label)
7846
{
7947
using (Context.BeginOperationScope())
@@ -100,18 +68,6 @@ public Models.Label EditProjectLabel(long projectId, ProjectLabelEdit label)
10068
}
10169
}
10270

103-
[EditorBrowsable(EditorBrowsableState.Never)]
104-
public Models.Label Edit(LabelEdit label)
105-
{
106-
return EditProjectLabel(label.Id, new ProjectLabelEdit
107-
{
108-
Name = label.Name,
109-
NewName = label.NewName,
110-
Color = label.Color,
111-
Description = label.Description,
112-
});
113-
}
114-
11571
public Models.Label EditGroupLabel(long groupId, GroupLabelEdit label)
11672
{
11773
using (Context.BeginOperationScope())
@@ -138,18 +94,6 @@ public Models.Label EditGroupLabel(long groupId, GroupLabelEdit label)
13894
}
13995
}
14096

141-
[EditorBrowsable(EditorBrowsableState.Never)]
142-
public Models.Label EditGroupLabel(LabelEdit label)
143-
{
144-
return EditGroupLabel(label.Id, new GroupLabelEdit
145-
{
146-
Name = label.Name,
147-
NewName = label.NewName,
148-
Color = label.Color,
149-
Description = label.Description,
150-
});
151-
}
152-
15397
public IEnumerable<Models.Label> ForGroup(long groupId)
15498
{
15599
return ForGroup(groupId, query: null);
@@ -196,12 +140,6 @@ public Models.Label GetProjectLabel(long projectId, string name)
196140
}
197141
}
198142

199-
[EditorBrowsable(EditorBrowsableState.Never)]
200-
public Models.Label GetLabel(long projectId, string name)
201-
{
202-
return GetProjectLabel(projectId, name);
203-
}
204-
205143
private static Label FindLabel(LabelsCollection collection, string name)
206144
{
207145
return collection.FirstOrDefault(x => x.Name.Equals(name, StringComparison.Ordinal));

NGitLab/ILabelClient.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public interface ILabelClient
4242
/// <returns></returns>
4343
Label GetProjectLabel(long projectId, string name);
4444

45-
[EditorBrowsable(EditorBrowsableState.Never)]
46-
Label GetLabel(long projectId, string name);
47-
4845
/// <summary>
4946
/// Return a specified label from the group or null;
5047
/// </summary>
@@ -61,9 +58,6 @@ public interface ILabelClient
6158
/// <returns></returns>
6259
Label CreateProjectLabel(long projectId, ProjectLabelCreate label);
6360

64-
[EditorBrowsable(EditorBrowsableState.Never)]
65-
Label Create(LabelCreate label);
66-
6761
/// <summary>
6862
/// Create a new label for a group.
6963
/// </summary>
@@ -72,9 +66,6 @@ public interface ILabelClient
7266
/// <returns></returns>
7367
Label CreateGroupLabel(long groupId, GroupLabelCreate label);
7468

75-
[EditorBrowsable(EditorBrowsableState.Never)]
76-
Label CreateGroupLabel(LabelCreate label);
77-
7869
/// <summary>
7970
/// Edit the contents of an existing project label.
8071
/// </summary>
@@ -83,9 +74,6 @@ public interface ILabelClient
8374
/// <returns></returns>
8475
Label EditProjectLabel(long projectId, ProjectLabelEdit label);
8576

86-
[EditorBrowsable(EditorBrowsableState.Never)]
87-
Label Edit(LabelEdit label);
88-
8977
/// <summary>
9078
/// Edit the contents of an existing label.
9179
/// </summary>
@@ -94,17 +82,11 @@ public interface ILabelClient
9482
/// <returns></returns>
9583
Label EditGroupLabel(long groupId, GroupLabelEdit label);
9684

97-
[EditorBrowsable(EditorBrowsableState.Never)]
98-
Label EditGroupLabel(LabelEdit label);
99-
10085
/// <summary>
10186
/// Delete a label from the project.
10287
/// </summary>
10388
/// <param name="projectId"></param>
10489
/// <param name="label"></param>
10590
/// <returns>True if "200", the success code for delete, was returned from the service.</returns>
10691
Label DeleteProjectLabel(long projectId, ProjectLabelDelete label);
107-
108-
[EditorBrowsable(EditorBrowsableState.Never)]
109-
Label Delete(LabelDelete label);
11092
}

NGitLab/Impl/LabelClient.cs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ public Label GetProjectLabel(long projectId, string name)
4848
return ForProject(projectId, new LabelQuery() { Search = name }).FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.Ordinal));
4949
}
5050

51-
[EditorBrowsable(EditorBrowsableState.Never)]
52-
public Label GetLabel(long projectId, string name)
53-
{
54-
return GetProjectLabel(projectId, name);
55-
}
56-
5751
public Label GetGroupLabel(long groupId, string name)
5852
{
5953
return ForGroup(groupId, new LabelQuery() { Search = name }).FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.Ordinal));
@@ -64,82 +58,26 @@ public Label CreateProjectLabel(long projectId, ProjectLabelCreate label)
6458
return _api.Post().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, ProjectLabelUrl, projectId));
6559
}
6660

67-
[EditorBrowsable(EditorBrowsableState.Never)]
68-
public Label Create(LabelCreate label)
69-
{
70-
return CreateProjectLabel(label.Id, new ProjectLabelCreate
71-
{
72-
Name = label.Name,
73-
Color = label.Color,
74-
Description = label.Description,
75-
});
76-
}
77-
7861
public Label CreateGroupLabel(long groupId, GroupLabelCreate label)
7962
{
8063
return _api.Post().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, GroupLabelUrl, groupId));
8164
}
8265

83-
[EditorBrowsable(EditorBrowsableState.Never)]
84-
public Label CreateGroupLabel(LabelCreate label)
85-
{
86-
return CreateGroupLabel(label.Id, new GroupLabelCreate
87-
{
88-
Name = label.Name,
89-
Color = label.Color,
90-
Description = label.Description,
91-
});
92-
}
93-
9466
public Label EditProjectLabel(long projectId, ProjectLabelEdit label)
9567
{
9668
return _api.Put().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, ProjectLabelUrl, projectId));
9769
}
9870

99-
[EditorBrowsable(EditorBrowsableState.Never)]
100-
public Label Edit(LabelEdit label)
101-
{
102-
return EditProjectLabel(label.Id, new ProjectLabelEdit
103-
{
104-
Name = label.Name,
105-
NewName = label.NewName,
106-
Color = label.Color,
107-
Description = label.Description,
108-
});
109-
}
110-
11171
public Label EditGroupLabel(long groupId, GroupLabelEdit label)
11272
{
11373
return _api.Put().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, GroupLabelUrl, groupId));
11474
}
11575

116-
[EditorBrowsable(EditorBrowsableState.Never)]
117-
public Label EditGroupLabel(LabelEdit label)
118-
{
119-
return EditGroupLabel(label.Id, new GroupLabelEdit
120-
{
121-
Name = label.Name,
122-
NewName = label.NewName,
123-
Color = label.Color,
124-
Description = label.Description,
125-
});
126-
}
127-
12876
public Label DeleteProjectLabel(long projectId, ProjectLabelDelete label)
12977
{
13078
return _api.Delete().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, ProjectLabelUrl, projectId));
13179
}
13280

133-
[EditorBrowsable(EditorBrowsableState.Never)]
134-
public Label Delete(LabelDelete label)
135-
{
136-
return DeleteProjectLabel(label.Id, new ProjectLabelDelete
137-
{
138-
Id = label.Id,
139-
Name = label.Name,
140-
});
141-
}
142-
14381
private static string AddLabelParameterQuery(string url, LabelQuery query)
14482
{
14583
if (query == null)

NGitLab/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,22 +341,16 @@ NGitLab.IJobClient.GetTraceAsync(long jobId, System.Threading.CancellationToken
341341
NGitLab.IJobClient.RunAction(long jobId, NGitLab.Models.JobAction action) -> NGitLab.Models.Job
342342
NGitLab.IJobClient.RunActionAsync(long jobId, NGitLab.Models.JobAction action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.Job>
343343
NGitLab.ILabelClient
344-
NGitLab.ILabelClient.Create(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
345344
NGitLab.ILabelClient.CreateGroupLabel(long groupId, NGitLab.Models.GroupLabelCreate label) -> NGitLab.Models.Label
346-
NGitLab.ILabelClient.CreateGroupLabel(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
347345
NGitLab.ILabelClient.CreateProjectLabel(long projectId, NGitLab.Models.ProjectLabelCreate label) -> NGitLab.Models.Label
348-
NGitLab.ILabelClient.Delete(NGitLab.Models.LabelDelete label) -> NGitLab.Models.Label
349346
NGitLab.ILabelClient.DeleteProjectLabel(long projectId, NGitLab.Models.ProjectLabelDelete label) -> NGitLab.Models.Label
350-
NGitLab.ILabelClient.Edit(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
351347
NGitLab.ILabelClient.EditGroupLabel(long groupId, NGitLab.Models.GroupLabelEdit label) -> NGitLab.Models.Label
352-
NGitLab.ILabelClient.EditGroupLabel(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
353348
NGitLab.ILabelClient.EditProjectLabel(long projectId, NGitLab.Models.ProjectLabelEdit label) -> NGitLab.Models.Label
354349
NGitLab.ILabelClient.ForGroup(long groupId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
355350
NGitLab.ILabelClient.ForGroup(long groupId, NGitLab.Models.LabelQuery labelQuery) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
356351
NGitLab.ILabelClient.ForProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
357352
NGitLab.ILabelClient.ForProject(long projectId, NGitLab.Models.LabelQuery labelQuery) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
358353
NGitLab.ILabelClient.GetGroupLabel(long groupId, string name) -> NGitLab.Models.Label
359-
NGitLab.ILabelClient.GetLabel(long projectId, string name) -> NGitLab.Models.Label
360354
NGitLab.ILabelClient.GetProjectLabel(long projectId, string name) -> NGitLab.Models.Label
361355
NGitLab.ILintClient
362356
NGitLab.ILintClient.ValidateCIYamlContentAsync(string projectId, string yamlContent, NGitLab.Models.LintCIOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.LintCI>
@@ -649,22 +643,16 @@ NGitLab.Impl.JobClient.JobClient(NGitLab.Impl.API api, NGitLab.Models.ProjectId
649643
NGitLab.Impl.JobClient.RunAction(long jobId, NGitLab.Models.JobAction action) -> NGitLab.Models.Job
650644
NGitLab.Impl.JobClient.RunActionAsync(long jobId, NGitLab.Models.JobAction action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.Job>
651645
NGitLab.Impl.LabelClient
652-
NGitLab.Impl.LabelClient.Create(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
653646
NGitLab.Impl.LabelClient.CreateGroupLabel(long groupId, NGitLab.Models.GroupLabelCreate label) -> NGitLab.Models.Label
654-
NGitLab.Impl.LabelClient.CreateGroupLabel(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
655647
NGitLab.Impl.LabelClient.CreateProjectLabel(long projectId, NGitLab.Models.ProjectLabelCreate label) -> NGitLab.Models.Label
656-
NGitLab.Impl.LabelClient.Delete(NGitLab.Models.LabelDelete label) -> NGitLab.Models.Label
657648
NGitLab.Impl.LabelClient.DeleteProjectLabel(long projectId, NGitLab.Models.ProjectLabelDelete label) -> NGitLab.Models.Label
658-
NGitLab.Impl.LabelClient.Edit(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
659649
NGitLab.Impl.LabelClient.EditGroupLabel(long groupId, NGitLab.Models.GroupLabelEdit label) -> NGitLab.Models.Label
660-
NGitLab.Impl.LabelClient.EditGroupLabel(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
661650
NGitLab.Impl.LabelClient.EditProjectLabel(long projectId, NGitLab.Models.ProjectLabelEdit label) -> NGitLab.Models.Label
662651
NGitLab.Impl.LabelClient.ForGroup(long groupId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
663652
NGitLab.Impl.LabelClient.ForGroup(long groupId, NGitLab.Models.LabelQuery query) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
664653
NGitLab.Impl.LabelClient.ForProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
665654
NGitLab.Impl.LabelClient.ForProject(long projectId, NGitLab.Models.LabelQuery query) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
666655
NGitLab.Impl.LabelClient.GetGroupLabel(long groupId, string name) -> NGitLab.Models.Label
667-
NGitLab.Impl.LabelClient.GetLabel(long projectId, string name) -> NGitLab.Models.Label
668656
NGitLab.Impl.LabelClient.GetProjectLabel(long projectId, string name) -> NGitLab.Models.Label
669657
NGitLab.Impl.LabelClient.LabelClient(NGitLab.Impl.API api) -> void
670658
NGitLab.Impl.LintClient

0 commit comments

Comments
 (0)