Skip to content

Commit 29cf9da

Browse files
authored
Get information about project (#70)
* Get information about project * Fix inline docs for service class * Update BaseFixture.cs * Fix test for user filter * Use gitversion as msbuild task * Update appveyor.yml * Update UserFilter.cs
1 parent e01b483 commit 29cf9da

File tree

14 files changed

+198
-38
lines changed

14 files changed

+198
-38
lines changed

appveyor.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
image: Visual Studio 2019
22

3+
environment:
4+
IGNORE_NORMALISATION_GIT_HEAD_MOVE: 1
5+
36
install:
4-
- gitversion /l console /output buildserver
57
- dotnet tool install -g codecov.tool
68

79
configuration:
810
- Release
911

10-
dotnet_csproj:
11-
patch: true
12-
version: '$(GitVersion_SemVer)'
13-
1412
build_script:
1513
- dotnet pack
1614

17-
after_build:
18-
- appveyor PushArtifact src\ReportPortal.Client\bin\%configuration%\ReportPortal.Client.%GitVersion_SemVer%.nupkg
19-
2015
test_script:
2116
- dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=OpenCover /p:CoverletOutput=./Coverage.xml
2217

2318
after_test:
24-
- codecov -f test\ReportPortal.Client.IntegrationTests\Coverage.*.xml
19+
- codecov -f test\ReportPortal.Client.IntegrationTests\Coverage.*.xml
20+
21+
artifacts:
22+
- path: '**\*.nupkg'
23+
- path: '**\*.html'

src/ReportPortal.Client/Abstractions/Requests/CreateUserFilterRequest.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,31 @@ public class CreateUserFilterRequest
3131
public IEnumerable<Condition> Conditions { get; set; }
3232

3333
/// <summary>
34-
/// list of parameters of selection
34+
/// List of parameters of selection.
3535
/// </summary>
3636
[DataMember(Name = "orders")]
3737
public IEnumerable<FilterOrder> Orders { get; set; }
3838

3939
/// <summary>
40-
/// is filter shared
40+
/// Indicates if filter is shared.
4141
/// </summary>
4242
[DataMember(Name = "share")]
4343
public bool IsShared { get; set; }
4444

4545
/// <summary>
46-
/// filter type
46+
/// Filter type.
4747
/// </summary>
4848
[DataMember(Name = "type")]
4949
public string TypeStr { get; set; }
5050

5151
/// <summary>
52-
/// user filter type enum
52+
/// Owner of the filter.
53+
/// </summary>
54+
[DataMember(Name = "owner")]
55+
public string Owner { get; set; }
56+
57+
/// <summary>
58+
/// User filter type enum.
5359
/// </summary>
5460
public UserFilterType UserFilterType
5561
{
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
using ReportPortal.Client.Abstractions.Responses;
2+
using ReportPortal.Client.Abstractions.Responses.Project;
23
using System.Threading.Tasks;
34

45
namespace ReportPortal.Client.Abstractions.Resources
56
{
67
public interface IProjectResource
78
{
9+
/// <summary>
10+
/// Returns information about current accosiated project.
11+
/// </summary>
12+
/// <returns>Project info.</returns>
13+
Task<ProjectResponse> GetAsync();
14+
15+
/// <summary>
16+
/// Returns information about project filtered by name.
17+
/// </summary>
18+
/// <returns>Project info.</returns>
19+
Task<ProjectResponse> GetAsync(string projectName);
20+
821
/// <summary>
922
/// Updates the project preference for user.
1023
/// </summary>
@@ -13,6 +26,6 @@ public interface IProjectResource
1326
/// <summary>
1427
/// Gets all user preferences.
1528
/// </summary>
16-
Task<PreferenceResponse> GetAllPreferences(string projectName, string userName);
29+
Task<PreferenceResponse> GetAllPreferencesAsync(string projectName, string userName);
1730
}
1831
}

src/ReportPortal.Client/Abstractions/Responses/PreferenceResponse.cs renamed to src/ReportPortal.Client/Abstractions/Responses/Project/PreferenceResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.Runtime.Serialization;
33

4-
namespace ReportPortal.Client.Abstractions.Responses
4+
namespace ReportPortal.Client.Abstractions.Responses.Project
55
{
66
[DataContract]
77
public class PreferenceResponse
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace ReportPortal.Client.Abstractions.Responses.Project
4+
{
5+
/// <summary>
6+
/// Information about project.
7+
/// </summary>
8+
[DataContract]
9+
public class ProjectConfiguration
10+
{
11+
[DataMember(Name = "subTypes")]
12+
public ProjectDefectSubTypesContainer DefectSubTypes { get; set; }
13+
}
14+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace ReportPortal.Client.Abstractions.Responses.Project
4+
{
5+
[DataContract]
6+
public class ProjectDefectSubType
7+
{
8+
[DataMember(Name = "id")]
9+
public long Id { get; set; }
10+
11+
[DataMember(Name = "color")]
12+
public string Color { get; set; }
13+
14+
[DataMember(Name = "locator")]
15+
public string Locator { get; set; }
16+
17+
[DataMember(Name = "longName")]
18+
public string LongName { get; set; }
19+
20+
[DataMember(Name = "shortName")]
21+
public string ShortName { get; set; }
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections.Generic;
2+
using System.Runtime.Serialization;
3+
4+
namespace ReportPortal.Client.Abstractions.Responses.Project
5+
{
6+
[DataContract]
7+
public class ProjectDefectSubTypesContainer
8+
{
9+
[DataMember(Name = "PRODUCT_BUG")]
10+
public IList<ProjectDefectSubType> ProductBugTypes { get; set; }
11+
12+
[DataMember(Name = "AUTOMATION_BUG")]
13+
public IList<ProjectDefectSubType> AutomationBugTypes { get; set; }
14+
15+
[DataMember(Name = "SYSTEM_ISSUE")]
16+
public IList<ProjectDefectSubType> SystemIssueTypes { get; set; }
17+
18+
[DataMember(Name = "TO_INVESTIGATE")]
19+
public IList<ProjectDefectSubType> ToInvestigateTypes { get; set; }
20+
21+
[DataMember(Name = "NO_DEFECT")]
22+
public IList<ProjectDefectSubType> NoDefectTypes { get; set; }
23+
}
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace ReportPortal.Client.Abstractions.Responses.Project
4+
{
5+
/// <summary>
6+
/// Information about project.
7+
/// </summary>
8+
[DataContract]
9+
public class ProjectResponse
10+
{
11+
[DataMember(Name = "projectId")]
12+
public string Id { get; set; }
13+
14+
[DataMember(Name = "projectName")]
15+
public string Name { get; set; }
16+
17+
[DataMember(Name = "configuration")]
18+
public ProjectConfiguration Configuration { get; set; }
19+
}
20+
}

src/ReportPortal.Client/ReportPortal.Client.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,11 @@
2626

2727
<None Include="..\..\Logo.png" Pack="true" PackagePath="\" Visible="false" />
2828
</ItemGroup>
29+
30+
<ItemGroup>
31+
<PackageReference Include="GitVersion.MsBuild" Version="5.8.1">
32+
<PrivateAssets>all</PrivateAssets>
33+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
34+
</PackageReference>
35+
</ItemGroup>
2936
</Project>

src/ReportPortal.Client/Resources/ServiceProjectResource.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ReportPortal.Client.Abstractions.Resources;
22
using ReportPortal.Client.Abstractions.Responses;
3+
using ReportPortal.Client.Abstractions.Responses.Project;
34
using System.Net.Http;
45
using System.Threading.Tasks;
56

@@ -12,14 +13,24 @@ public ServiceProjectResource(HttpClient httpClient, string project) : base(http
1213

1314
}
1415

16+
public Task<ProjectResponse> GetAsync()
17+
{
18+
return GetAsJsonAsync<ProjectResponse>($"project/{this.ProjectName}");
19+
}
20+
21+
public Task<ProjectResponse> GetAsync(string projectName)
22+
{
23+
return GetAsJsonAsync<ProjectResponse>($"project/{projectName}");
24+
}
25+
1526
public Task<MessageResponse> UpdatePreferencesAsync(string projectName, string userName, long filterId)
1627
{
1728
return PutAsJsonAsync<MessageResponse, object>(
1829
$"project/{projectName}/preference/{userName}/{filterId}",
1930
string.Empty);
2031
}
2132

22-
public Task<PreferenceResponse> GetAllPreferences(string projectName, string userName)
33+
public Task<PreferenceResponse> GetAllPreferencesAsync(string projectName, string userName)
2334
{
2435
return GetAsJsonAsync<PreferenceResponse>($"project/{projectName}/preference/{userName}");
2536
}

0 commit comments

Comments
 (0)