Skip to content

Commit 968dec5

Browse files
committed
feat: new classes Hash and Obligation
1 parent d8ebbf5 commit 968dec5

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* add support for groups for all methods where it did not yet exist.
1010
* new method GetInfo().
1111
* support for licenses added: new methods GetLicenseList(), GetLicense(), CreateLicense().
12+
* code coverage support
13+
* new classes Hash and Obligation.
1214

1315
## 1.1.0 (2020-06-25)
1416
* supports FOSSology REST API v1.0.16 (FOSSology 3.8.0 built @ 2020/06/19).

Fossology.Rest.Dotnet.Model/Hash.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// ---------------------------------------------------------------------------
2+
// <copyright file="Hash.cs" company="Tethys">
3+
// Copyright (C) 2022 T. Graf
4+
// </copyright>
5+
//
6+
// Licensed under the MIT License.
7+
// SPDX-License-Identifier: MIT
8+
//
9+
// Unless required by applicable law or agreed to in writing,
10+
// software distributed under the License is distributed on an
11+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
// either express or implied.
13+
// ---------------------------------------------------------------------------
14+
15+
namespace Fossology.Rest.Dotnet.Model
16+
{
17+
using Newtonsoft.Json;
18+
19+
/// <summary>
20+
/// Fossology hash information.
21+
/// </summary>
22+
public class Hash
23+
{
24+
/// <summary>
25+
/// Gets or sets the SHA1 hash.
26+
/// </summary>
27+
[JsonProperty("sha1")]
28+
public string Sha1 { get; set; }
29+
30+
/// <summary>
31+
/// Gets or sets the MD5 hash.
32+
/// </summary>
33+
[JsonProperty("md5")]
34+
public string Md5 { get; set; }
35+
36+
/// <summary>
37+
/// Gets or sets the SHA256 hash.
38+
/// </summary>
39+
[JsonProperty("sha256")]
40+
public string Sha256 { get; set; }
41+
42+
/// <summary>
43+
/// Gets or sets the size of the file in bytes.
44+
/// </summary>
45+
[JsonProperty("size")]
46+
public int Size { get; set; }
47+
48+
/// <inheritdoc />
49+
public override string ToString()
50+
{
51+
return $"SHA1={this.Sha1}, MD5={this.Md5}, SHA256={this.Sha256}, size={this.Size}'";
52+
}
53+
} // Hash
54+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// ---------------------------------------------------------------------------
2+
// <copyright file="Obligation.cs" company="Tethys">
3+
// Copyright (C) 2022 T. Graf
4+
// </copyright>
5+
//
6+
// Licensed under the MIT License.
7+
// SPDX-License-Identifier: MIT
8+
//
9+
// Unless required by applicable law or agreed to in writing,
10+
// software distributed under the License is distributed on an
11+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
// either express or implied.
13+
// ---------------------------------------------------------------------------
14+
15+
namespace Fossology.Rest.Dotnet.Model
16+
{
17+
using Newtonsoft.Json;
18+
19+
/// <summary>
20+
/// Fossology obligation information.
21+
/// </summary>
22+
public class Obligation
23+
{
24+
/// <summary>
25+
/// Gets or sets the id.
26+
/// </summary>
27+
[JsonProperty("id")]
28+
public int Id { get; set; }
29+
30+
/// <summary>
31+
/// Gets or sets the obligation topic.
32+
/// </summary>
33+
[JsonProperty("topic")]
34+
public string Topic { get; set; }
35+
36+
/// <summary>
37+
/// Gets or sets the obligation type.
38+
/// </summary>
39+
[JsonProperty("type")]
40+
public string Type { get; set; }
41+
42+
/// <summary>
43+
/// Gets or sets the text.
44+
/// </summary>
45+
[JsonProperty("text")]
46+
public string Text { get; set; }
47+
48+
/// <summary>
49+
/// Gets or sets the classification.
50+
/// </summary>
51+
[JsonProperty("classification")]
52+
public string Classification { get; set; }
53+
54+
/// <summary>
55+
/// Gets or sets the comment.
56+
/// </summary>
57+
[JsonProperty("comment")]
58+
public string Comment { get; set; }
59+
60+
/// <inheritdoc />
61+
public override string ToString()
62+
{
63+
return $"{this.Id}: {this.Topic}, parent={this.Type}, '{this.Text}'";
64+
}
65+
} // Obligation
66+
}

0 commit comments

Comments
 (0)