/
HasOneCapabilities.shared.cs
35 lines (29 loc) · 1.2 KB
/
HasOneCapabilities.shared.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
using JetBrains.Annotations;
namespace JsonApiDotNetCore.Resources.Annotations;
/// <summary>
/// Indicates what can be performed on a <see cref="HasOneAttribute" />.
/// </summary>
[PublicAPI]
[Flags]
public enum HasOneCapabilities
{
None = 0,
/// <summary>
/// Whether or not the relationship can be returned in responses. Attempts to explicitly request it via the <c>fields</c> query string parameter when
/// disabled will return an HTTP 400 response. Otherwise, the relationship (and its related resources, when included) are silently omitted.
/// </summary>
/// <remarks>
/// Note this setting does not affect retrieving the related resources directly.
/// </remarks>
AllowView = 1,
/// <summary>
/// Whether or not the relationship can be included. Attempts to use it in the <c>include</c> query string parameter when disabled will return an HTTP
/// 400 response.
/// </summary>
AllowInclude = 1 << 1,
/// <summary>
/// Whether or not POST and PATCH requests can replace the relationship. Attempts to replace when disabled will return an HTTP 422 response.
/// </summary>
AllowSet = 1 << 2,
All = AllowView | AllowInclude | AllowSet
}