Skip to content

Commit 06badfa

Browse files
committed
fix all warnings, add more docs
1 parent a7a04dd commit 06badfa

14 files changed

+131
-6
lines changed

Modrinth.Net/Extensions/EnumerableExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
namespace Modrinth.Extensions;
44

5+
/// <summary>
6+
/// Extensions for <see cref="IEnumerable{T}" />
7+
/// </summary>
58
public static class EnumerableExtensions
69
{
10+
/// <summary>
11+
/// Converts an <see cref="IEnumerable{T}" /> to a query string for Modrinth
12+
/// <para> It needs to be in format like this: ["AABBCCDD", "EEFFGGHH"] </para>
13+
/// </summary>
14+
/// <param name="items"></param>
15+
/// <typeparam name="T"></typeparam>
16+
/// <returns></returns>
717
public static string ToModrinthQueryString<T>(this IEnumerable<T> items)
818
{
919
// It needs to be in format like this: ["AABBCCDD", "EEFFGGHH"]

Modrinth.Net/Extensions/ProjectExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace Modrinth.Extensions;
55

6+
/// <summary>
7+
/// Extensions for <see cref="Project" />
8+
/// </summary>
69
public static class ProjectExtensions
710
{
811
/// <summary>

Modrinth.Net/Extensions/ProjectTypeExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Modrinth.Extensions;
44

5+
/// <summary>
6+
/// Extensions for <see cref="ProjectType" />
7+
/// </summary>
58
public static class ProjectTypeExtensions
69
{
710
/// <summary>

Modrinth.Net/Extensions/StringExtensions.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
namespace Modrinth.Extensions;
22

3+
/// <summary>
4+
/// Extensions for <see cref="string" />
5+
/// </summary>
36
public static class StringExtensions
47
{
58
/// <summary>
6-
/// Add text in quotes if text contains specific char
9+
/// Escapes the specified input string with double quotes if it contains the specified character.
710
/// </summary>
8-
/// <param name="text"></param>
9-
/// <param name="contains">The char to check if the text contains</param>
10-
/// <returns></returns>
11+
/// <param name="text">The input string to check for the specified character.</param>
12+
/// <param name="contains">The character to check if it is contained in the input string. Defaults to a space character.</param>
13+
/// <returns>
14+
/// The input string enclosed within double quotes if it contains the specified character;
15+
/// otherwise, the input string as is.
16+
/// </returns>
1117
public static string EscapeIfContains(this string text, char contains = ' ')
1218
{
1319
return !string.IsNullOrEmpty(text) && text.Contains(contains) ? string.Concat('"', text, '"') : text;

Modrinth.Net/Extensions/VersionExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace Modrinth.Extensions;
55

6+
/// <summary>
7+
/// Extensions for <see cref="Models.Version" />
8+
/// </summary>
69
public static class VersionExtensions
710
{
811
/// <summary>

Modrinth.Net/Facet.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace Modrinth;
55

6+
/// <summary>
7+
/// A facet for the filtering of results
8+
/// </summary>
69
public abstract class Facet
710
{
811
/// <summary>
@@ -46,17 +49,32 @@ public static Facet<string> ProjectType(ProjectType projectType)
4649
}
4750
}
4851

52+
/// <summary>
53+
/// A facet for the filtering of results, with a specific type
54+
/// </summary>
55+
/// <typeparam name="T"></typeparam>
4956
public class Facet<T> : Facet
5057
{
51-
public Facet(FacetType type, T value)
58+
internal Facet(FacetType type, T value)
5259
{
5360
Type = type;
5461
Value = value;
5562
}
5663

64+
/// <summary>
65+
/// The type of the facet
66+
/// </summary>
5767
public FacetType Type { get; }
68+
69+
/// <summary>
70+
/// The value of the facet
71+
/// </summary>
5872
public T Value { get; }
5973

74+
/// <summary>
75+
/// Returns a string representation of the facet, so that it is usable in API requests
76+
/// </summary>
77+
/// <returns></returns>
6078
public override string ToString()
6179
{
6280
return Type switch
@@ -70,10 +88,28 @@ public override string ToString()
7088
}
7189
}
7290

91+
/// <summary>
92+
/// The type of a facet
93+
/// </summary>
7394
public enum FacetType
7495
{
96+
/// <summary>
97+
/// The facet is for filtering by category
98+
/// </summary>
7599
Categories,
100+
101+
/// <summary>
102+
/// The facet is for filtering by Minecraft version
103+
/// </summary>
76104
Versions,
105+
106+
/// <summary>
107+
/// The facet is for filtering by license
108+
/// </summary>
77109
License,
110+
111+
/// <summary>
112+
/// The facet is for filtering by project type
113+
/// </summary>
78114
ProjectType
79115
}

Modrinth.Net/Http/Requester.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public class Requester : IRequester
2222
}
2323
};
2424

25+
/// <summary>
26+
/// Creates a new <see cref="Requester" /> with the specified <see cref="ModrinthClientConfig" />
27+
/// </summary>
28+
/// <param name="config"> The config to use </param>
29+
/// <param name="httpClient"> The <see cref="HttpClient" /> to use, if null a new one will be created </param>
2530
public Requester(ModrinthClientConfig config, HttpClient? httpClient = null)
2631
{
2732
_config = config;

Modrinth.Net/Models/Enums/Version/DependencyType.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace Modrinth.Models.Enums.Version;
22

3+
/// <summary>
4+
/// The type of a dependency
5+
/// </summary>
36
public enum DependencyType
47
{
58
/// <summary>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
namespace Modrinth.Models.Enums.Version;
22

3+
/// <summary>
4+
/// The requested status of a version
5+
/// </summary>
36
public enum VersionRequestedStatus
47
{
8+
/// <summary>
9+
/// The version is requested to be listed
10+
/// </summary>
511
Listed,
12+
13+
/// <summary>
14+
/// The version is requested to be archived
15+
/// </summary>
616
Archived,
17+
18+
/// <summary>
19+
/// The version is requested to be in a draft
20+
/// </summary>
721
Draft,
22+
23+
/// <summary>
24+
/// The version is requested to be unlisted
25+
/// </summary>
826
Unlisted
927
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
namespace Modrinth.Models.Enums.Version;
22

3+
/// <summary>
4+
/// The status of a version
5+
/// </summary>
36
public enum VersionStatus
47
{
8+
/// <summary>
9+
/// The version is listed
10+
/// </summary>
511
Listed,
12+
13+
/// <summary>
14+
/// The version is archived
15+
/// </summary>
616
Archived,
17+
18+
/// <summary>
19+
/// The version is in a draft
20+
/// </summary>
721
Draft,
22+
23+
/// <summary>
24+
/// The version is unlisted
25+
/// </summary>
826
Unlisted,
27+
28+
/// <summary>
29+
/// The version is scheduled for release
30+
/// </summary>
931
Scheduled,
32+
33+
/// <summary>
34+
/// The version status is unknown
35+
/// </summary>
1036
Unknown
1137
}

Modrinth.Net/Models/File.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#pragma warning disable CS8618
55
namespace Modrinth.Models;
66

7+
/// <summary>
8+
/// A file of a project version
9+
/// </summary>
710
public class File
811
{
912
/// <summary>
@@ -21,6 +24,9 @@ public class File
2124
/// </summary>
2225
public string FileName { get; set; }
2326

27+
/// <summary>
28+
/// Whether the file is the primary file of the version
29+
/// </summary>
2430
public bool Primary { get; set; }
2531

2632
/// <summary>

Modrinth.Net/Models/Notification.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Text.Json.Serialization;
22
using Modrinth.Models.Enums;
33

4+
#pragma warning disable CS8618
45
namespace Modrinth.Models;
56

67
/// <summary>

Modrinth.Net/Models/PayoutData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Text.Json.Serialization;
22
using Modrinth.Models.Enums;
33

4+
#pragma warning disable CS8618
45
namespace Modrinth.Models;
56

67
/// <summary>

Modrinth.Net/Models/Version.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ public class Version
7070
[JsonPropertyName("author_id")]
7171
public string AuthorId { get; set; }
7272

73-
[JsonPropertyName("date_published")] public DateTime DatePublished { get; set; }
73+
/// <summary>
74+
/// The time at which this version was created
75+
/// </summary>
76+
[JsonPropertyName("date_published")]
77+
public DateTime DatePublished { get; set; }
7478

7579
/// <summary>
7680
/// The number of times this version has been downloaded

0 commit comments

Comments
 (0)