|
1 | 1 | // --------------------------------------------------------------------------- |
2 | 2 | // <copyright file="FossologyClient.cs" company="Tethys"> |
3 | | -// Copyright (C) 2019 T. Graf |
| 3 | +// Copyright (C) 2019-2022 T. Graf |
4 | 4 | // </copyright> |
5 | 5 | // |
6 | 6 | // Licensed under the MIT License. |
@@ -507,13 +507,24 @@ public UploadSummary GetUploadSummary(int id) |
507 | 507 | /// Gets the upload with the specified id. |
508 | 508 | /// </summary> |
509 | 509 | /// <returns>A list of <see cref="Upload"/> objects.</returns> |
510 | | - public IReadOnlyList<Upload> GetUploadList() |
| 510 | + /// <param name="groupName">The group name to use while retrieving uploads.</param> |
| 511 | + public IReadOnlyList<Upload> GetUploadList(string groupName = "") |
511 | 512 | { |
512 | 513 | Log.Debug("Getting all uploads..."); |
513 | 514 |
|
514 | | - var result = this.api.Get(this.Url + "/uploads"); |
| 515 | + var request = new RestRequest(this.Url + $"/uploads", Method.GET); |
| 516 | + request.RequestFormat = DataFormat.Json; |
| 517 | + request.JsonSerializer = new JsonSerializer(); |
| 518 | + request.Parameters.Clear(); |
| 519 | + if (!string.IsNullOrEmpty(groupName)) |
| 520 | + { |
| 521 | + request.AddHeader("groupName", groupName); |
| 522 | + } // if |
| 523 | + |
| 524 | + var response = this.api.Execute(request); |
| 525 | + |
515 | 526 | var list = JsonConvert.DeserializeObject<List<Upload>>( |
516 | | - result.Content, |
| 527 | + response.Content, |
517 | 528 | new JsonSerializerSettings |
518 | 529 | { |
519 | 530 | NullValueHandling = NullValueHandling.Ignore, |
@@ -818,6 +829,26 @@ public IReadOnlyList<SearchResult> Search( |
818 | 829 | return result; |
819 | 830 | } // Search() |
820 | 831 | #endregion // SEARCH SUPPORT |
| 832 | + |
| 833 | + #region HEALTH SUPPORT |
| 834 | + /// <summary> |
| 835 | + /// Gets the health information. |
| 836 | + /// </summary> |
| 837 | + /// <returns><see cref="HealthInfo"/>.</returns> |
| 838 | + public HealthInfo GetHealth() |
| 839 | + { |
| 840 | + Log.Debug($"Getting health info..."); |
| 841 | + |
| 842 | + var result = this.api.Get(this.Url + $"/health"); |
| 843 | + var info = JsonConvert.DeserializeObject<HealthInfo>( |
| 844 | + result.Content, |
| 845 | + new JsonSerializerSettings |
| 846 | + { |
| 847 | + NullValueHandling = NullValueHandling.Ignore, |
| 848 | + }); |
| 849 | + return info; |
| 850 | + } // GetHealth() |
| 851 | + #endregion |
821 | 852 | #endregion // PUBLIC METHODS |
822 | 853 | } // FossologyClient |
823 | 854 | } |
0 commit comments