Skip to content

Commit f53bcf2

Browse files
committed
Updates for REST API version 1.0.16
1 parent 0ed51ba commit f53bcf2

35 files changed

+3500
-255
lines changed

ChangeLog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ChangeLog - FOSSology.REST.dotnet
2+
3+
## 1.1.0 (NEXT)
4+
* supports FOSSOlogy REST API v1.0.16 (FOSSology 3.8.0).
5+
* ?? /uploads/{id}/summary:
6+
* ?? /uploads/{id}/licenses:
7+
* ?? search using groupName
8+
* ?? new param groupName for report generation
9+
* ?? ojo for license decider
10+
11+
* new method GetToken().
12+
* new method UploadPackageFromUrl().
13+
* new method UploadPackageFromVcs().
14+
* new method UploadPackageFromServer() (not tested).
15+
* new method GetUploadSummary()
16+
* new method GetUploadLicenses()
17+
* new class UploadSummary.
18+
* new class UploadLicenses.
19+
* new class VcsUpload.
20+
* new class ServerUpload.
21+
* new class UrlUpload.
22+
* class Upload has new property FileSha1
23+
* Integration test improved.
24+
25+
26+
## 1.0.0 (2020-11-24)
27+
* first version released.
28+
* supports FOSSOlogy REST API v1.0.3 (FOSSology 3.7.0).
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#region Header
2+
// ---------------------------------------------------------------------------
3+
// <copyright file="Analysis.cs" company="Tethys">
4+
// Copyright (C) 2020 T. Graf
5+
// </copyright>
6+
//
7+
// Licensed under the MIT License.
8+
// SPDX-License-Identifier: MIT
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
// either express or implied.
14+
// ---------------------------------------------------------------------------
15+
#endregion
16+
17+
namespace Fossology.Rest.Dotnet.Model
18+
{
19+
using Newtonsoft.Json;
20+
21+
/// <summary>
22+
/// Trigger analysis information.
23+
/// </summary>
24+
public class Analysis
25+
{
26+
/// <summary>
27+
/// Gets or sets a value indicating whether to use the bucket.
28+
/// </summary>
29+
[JsonProperty("bucket")]
30+
public bool Bucket { get; set; }
31+
32+
/// <summary>
33+
/// Gets or sets a value indicating whether to use copyright email author.
34+
/// </summary>
35+
[JsonProperty("copyright_email_author")]
36+
public bool CopyrightEmailAuthor { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets a value indicating whether to use the ecc scanner.
40+
/// </summary>
41+
[JsonProperty("ecc")]
42+
public bool Ecc { get; set; }
43+
44+
/// <summary>
45+
/// Gets or sets a value indicating whether to use the keyword scanner.
46+
/// </summary>
47+
[JsonProperty("keyword")]
48+
public bool Keyword { get; set; }
49+
50+
/// <summary>
51+
/// Gets or sets a value indicating whether to use the mime scanner.
52+
/// </summary>
53+
[JsonProperty("mime")]
54+
public bool Mime { get; set; }
55+
56+
/// <summary>
57+
/// Gets or sets a value indicating whether to use the monk scanner.
58+
/// </summary>
59+
[JsonProperty("monk")]
60+
public bool Monk { get; set; }
61+
62+
/// <summary>
63+
/// Gets or sets a value indicating whether to use the nomos scanner.
64+
/// </summary>
65+
[JsonProperty("nomos")]
66+
public bool Nomos { get; set; }
67+
68+
/// <summary>
69+
/// Gets or sets a value indicating whether to use the <c>ojo</c> scanner.
70+
/// </summary>
71+
[JsonProperty("ojo")]
72+
public bool Ojo { get; set; }
73+
74+
/// <summary>
75+
/// Gets or sets a value indicating whether to use the package scanner.
76+
/// </summary>
77+
[JsonProperty("package")]
78+
public bool Package { get; set; }
79+
} // Analysis
80+
}

Fossology.Rest.Dotnet.Model/Fossology.Rest.dotnet.Model.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@
3434
<ItemGroup>
3535
<Reference Include="System" />
3636
<Reference Include="System.Core" />
37-
<Reference Include="System.Runtime.Serialization" />
3837
</ItemGroup>
3938
<ItemGroup>
39+
<Compile Include="..\GlobalAssemblyInfo.cs">
40+
<Link>Properties\GlobalAssemblyInfo.cs</Link>
41+
</Compile>
4042
<Compile Include="SearchResult.cs" />
43+
<Compile Include="Analysis.cs" />
44+
<Compile Include="Support.cs" />
45+
<Compile Include="TokenResponse.cs" />
46+
<Compile Include="TokenRequest.cs" />
47+
<Compile Include="UploadSummary.cs" />
48+
<Compile Include="UploadLicenses.cs" />
49+
<Compile Include="VcsUpload.cs" />
50+
<Compile Include="ServerUpload.cs" />
51+
<Compile Include="UrlUpload.cs" />
4152
<Compile Include="Upload.cs" />
4253
<Compile Include="User.cs" />
4354
<Compile Include="TriggerInfo.cs" />

Fossology.Rest.Dotnet.Model/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#region Header
22
// ---------------------------------------------------------------------------
33
// <copyright file="AssemblyInfo.cs" company="Tethys">
4-
// Copyright (C) 2019 T. Graf
4+
// Copyright (C) 2019-2020 T. Graf
55
// </copyright>
66
//
77
// Licensed under the MIT License.
@@ -23,11 +23,7 @@
2323
[assembly: AssemblyTitle("Fossology.Rest.Dotnet.Model")]
2424
[assembly: AssemblyDescription("")]
2525
[assembly: AssemblyConfiguration("")]
26-
[assembly: AssemblyCompany("")]
2726
[assembly: AssemblyProduct("Fossology.Rest.Dotnet.Model")]
28-
[assembly: AssemblyCopyright("Copyright © 2019 T. Graf")]
29-
[assembly: AssemblyTrademark("")]
30-
[assembly: AssemblyCulture("")]
3127

3228
// Setting ComVisible to false makes the types in this assembly not visible
3329
// to COM components. If you need to access a type in this assembly from
@@ -36,7 +32,3 @@
3632

3733
// The following GUID is for the ID of the typelib if this project is exposed to COM
3834
[assembly: Guid("396e05c3-9ad3-4d1b-8e0b-8c24c6c490eb")]
39-
40-
// Version information for an assembly consists of the following four values:
41-
[assembly: AssemblyVersion("1.0.0.0")]
42-
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#region Header
2+
// ---------------------------------------------------------------------------
3+
// <copyright file="ServerUpload.cs" company="Tethys">
4+
// Copyright (C) 2020 T. Graf
5+
// </copyright>
6+
//
7+
// Licensed under the MIT License.
8+
// SPDX-License-Identifier: MIT
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
// either express or implied.
14+
// ---------------------------------------------------------------------------
15+
#endregion
16+
17+
namespace Fossology.Rest.Dotnet.Model
18+
{
19+
using Newtonsoft.Json;
20+
21+
/// <summary>
22+
/// Information to create an upload from a server.
23+
/// </summary>
24+
/// <remarks>
25+
/// </remarks>
26+
public class ServerUpload
27+
{
28+
/// <summary>
29+
/// Gets or sets the file path to be uploaded (recursive, supports *).
30+
/// </summary>
31+
[JsonProperty("path")]
32+
public string Path { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the viewable name for this file or directory.
36+
/// </summary>
37+
[JsonProperty("name")]
38+
public string Name { get; set; }
39+
40+
41+
/// <inheritdoc />
42+
public override string ToString()
43+
{
44+
return $"{this.Name}: {this.Path}";
45+
} // ToString()
46+
} // ServerUpload
47+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#region Header
2+
// ---------------------------------------------------------------------------
3+
// <copyright file="Support.cs" company="Tethys">
4+
// Copyright (C) 2020 T. Graf
5+
// </copyright>
6+
//
7+
// Licensed under the MIT License.
8+
// SPDX-License-Identifier: MIT
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
// either express or implied.
14+
// ---------------------------------------------------------------------------
15+
#endregion
16+
17+
namespace Fossology.Rest.Dotnet.Model
18+
{
19+
using System.Collections.Generic;
20+
21+
/// <summary>
22+
/// Support methods.
23+
/// </summary>
24+
public class Support
25+
{
26+
/// <summary>
27+
/// List to string.
28+
/// </summary>
29+
/// <param name="list">The list.</param>
30+
/// <returns>A single string.</returns>
31+
public static string ListToString(IReadOnlyList<string> list)
32+
{
33+
if (list == null)
34+
{
35+
return string.Empty;
36+
} // if
37+
38+
var joined = string.Join(",", list);
39+
return joined;
40+
} // ListToString()
41+
} // Support
42+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#region Header
2+
// ---------------------------------------------------------------------------
3+
// <copyright file="TokenRequest.cs" company="Tethys">
4+
// Copyright (C) 2020 T. Graf
5+
// </copyright>
6+
//
7+
// Licensed under the MIT License.
8+
// SPDX-License-Identifier: MIT
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
// either express or implied.
14+
// ---------------------------------------------------------------------------
15+
#endregion
16+
17+
namespace Fossology.Rest.Dotnet.Model
18+
{
19+
using Newtonsoft.Json;
20+
21+
/// <summary>
22+
/// Information to create an access token.
23+
/// </summary>
24+
/// <remarks>
25+
/// </remarks>
26+
public class TokenRequest
27+
{
28+
/// <summary>
29+
/// Gets or sets the user name.
30+
/// </summary>
31+
[JsonProperty("username")]
32+
public string Username { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the password.
36+
/// </summary>
37+
[JsonProperty("password")]
38+
public string Password { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the token name.
42+
/// </summary>
43+
[JsonProperty("token_name")]
44+
public string TokenName { get; set; }
45+
46+
/// <summary>
47+
/// Gets or sets the token scope, one of (read, write).
48+
/// </summary>
49+
[JsonProperty("token_scope")]
50+
public string TokenScope { get; set; }
51+
52+
/// <summary>
53+
/// Gets or sets the token expiry date.
54+
/// </summary>
55+
/// <remarks>Date format is yyyy-mm-dd.</remarks>
56+
[JsonProperty("token_expire")]
57+
public string TokenExpire { get; set; }
58+
59+
60+
/// <inheritdoc />
61+
public override string ToString()
62+
{
63+
return $"{this.TokenName}: {this.Username}, {this.Password}, {this.TokenScope}, {this.TokenExpire}";
64+
} // ToString()
65+
} // TokenRequest
66+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#region Header
2+
// ---------------------------------------------------------------------------
3+
// <copyright file="TokenResponse.cs" company="Tethys">
4+
// Copyright (C) 2020 T. Graf
5+
// </copyright>
6+
//
7+
// Licensed under the MIT License.
8+
// SPDX-License-Identifier: MIT
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
// either express or implied.
14+
// ---------------------------------------------------------------------------
15+
#endregion
16+
17+
namespace Fossology.Rest.Dotnet.Model
18+
{
19+
using Newtonsoft.Json;
20+
21+
/// <summary>
22+
/// Data returned by a token generation request.
23+
/// </summary>
24+
/// <remarks>
25+
/// </remarks>
26+
public class TokenResponse
27+
{
28+
#region PUBLIC PROPERTIES
29+
/// <summary>
30+
/// Gets or sets the authorization value.
31+
/// </summary>
32+
[JsonProperty("Authorization")]
33+
public string Authorization { get; set; }
34+
#endregion // PUBLIC PROPERTIES
35+
36+
//// ---------------------------------------------------------------------
37+
38+
#region PUBLIC METHODS
39+
/// <summary>
40+
/// Gets the plain token.
41+
/// </summary>
42+
/// <returns>The token.</returns>
43+
public string GetPlainToken()
44+
{
45+
if (string.IsNullOrEmpty(this.Authorization))
46+
{
47+
return string.Empty;
48+
} // if
49+
50+
var token = this.Authorization.Substring("Bearer ".Length);
51+
return token;
52+
} // GetPlainToken()
53+
54+
/// <inheritdoc />
55+
public override string ToString()
56+
{
57+
return $"{this.Authorization}";
58+
} // ToString()
59+
#endregion // PUBLIC METHODS
60+
61+
//// ---------------------------------------------------------------------
62+
63+
#region PRIVATE METHODS
64+
#endregion // PRIVATE METHODS
65+
66+
} // ServerUpload
67+
}

0 commit comments

Comments
 (0)