-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathConstants.cs
37 lines (33 loc) · 1.34 KB
/
Constants.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Text.Json;
using System.Text.Json.Serialization;
using Meilisearch.Converters;
namespace Meilisearch
{
/// <summary>
/// This class adds some defaults to work with Meilisearch client.
/// </summary>
internal static class Constants
{
/// <summary>
/// JsonSerializer options used when serializing objects that needs to remove null values.
/// </summary>
internal static readonly JsonSerializerOptions JsonSerializerOptionsRemoveNulls = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
/// <summary>
/// JsonSerializer options used when serializing objects that keeps null values.
/// </summary>
internal static readonly JsonSerializerOptions JsonSerializerOptionsWriteNulls = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
internal static string VersionErrorHintMessage(string message, string method)
{
return
$"{message}\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ${method} call requires.";
}
}
}