Skip to content

Commit cae406d

Browse files
committed
Document JsonApiEndpoints enum
1 parent a4895a4 commit cae406d

File tree

2 files changed

+172
-0
lines changed

2 files changed

+172
-0
lines changed

src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs

+86
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,106 @@ namespace JsonApiDotNetCore.Controllers;
77
[Flags]
88
public enum JsonApiEndpoints
99
{
10+
/// <summary>
11+
/// Represents none of the JSON:API endpoints.
12+
/// </summary>
1013
None = 0,
14+
15+
/// <summary>
16+
/// Represents the endpoint to get a collection of primary resources. Example: <code><![CDATA[
17+
/// GET /articles HTTP/1.1
18+
/// ]]></code>
19+
/// </summary>
1120
GetCollection = 1,
21+
22+
/// <summary>
23+
/// Represents the endpoint to get a single primary resource by ID. Example: <code><![CDATA[
24+
/// GET /articles/1 HTTP/1.1
25+
/// ]]></code>
26+
/// </summary>
1227
GetSingle = 1 << 1,
28+
29+
/// <summary>
30+
/// Represents the endpoint to get a secondary resource or collection of secondary resources. Example:
31+
/// <code><![CDATA[
32+
/// GET /articles/1/author HTTP/1.1
33+
/// ]]></code> Example: <code><![CDATA[
34+
/// GET /articles/1/revisions HTTP/1.1
35+
/// ]]></code>
36+
/// </summary>
1337
GetSecondary = 1 << 2,
38+
39+
/// <summary>
40+
/// Represents the endpoint to get a relationship value. Example: <code><![CDATA[
41+
/// GET /articles/1/relationships/author HTTP/1.1
42+
/// ]]></code> Example:
43+
/// <code><![CDATA[
44+
/// GET /articles/1/relationships/revisions HTTP/1.1
45+
/// ]]></code>
46+
/// </summary>
1447
GetRelationship = 1 << 3,
48+
49+
/// <summary>
50+
/// Represents the endpoint to create a new resource with attributes, relationships or both. Example:
51+
/// <code><![CDATA[
52+
/// POST /articles HTTP/1.1
53+
/// ]]></code>
54+
/// </summary>
1555
Post = 1 << 4,
56+
57+
/// <summary>
58+
/// Represents the endpoint to add resources to a to-many relationship. Example: <code><![CDATA[
59+
/// POST /articles/1/revisions HTTP/1.1
60+
/// ]]></code>
61+
/// </summary>
1662
PostRelationship = 1 << 5,
63+
64+
/// <summary>
65+
/// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example:
66+
/// <code><![CDATA[
67+
/// PATCH /articles/1
68+
/// ]]></code>
69+
/// </summary>
1770
Patch = 1 << 6,
71+
72+
/// <summary>
73+
/// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example:
74+
/// <code><![CDATA[
75+
/// PATCH /articles/1/relationships/author HTTP/1.1
76+
/// ]]></code> Example:
77+
/// <code><![CDATA[
78+
/// PATCH /articles/1/relationships/revisions HTTP/1.1
79+
/// ]]></code>
80+
/// </summary>
1881
PatchRelationship = 1 << 7,
82+
83+
/// <summary>
84+
/// Represents the endpoint to delete an existing resource. Example: <code><![CDATA[
85+
/// DELETE /articles/1
86+
/// ]]></code>
87+
/// </summary>
1988
Delete = 1 << 8,
89+
90+
/// <summary>
91+
/// Represents the endpoint to remove resources from a to-many relationship. Example:
92+
/// <code><![CDATA[
93+
/// DELETE /articles/1/relationships/revisions
94+
/// ]]></code>
95+
/// </summary>
2096
DeleteRelationship = 1 << 9,
2197

98+
/// <summary>
99+
/// Represents the set of JSON:API endpoints to query resources and relationships.
100+
/// </summary>
22101
Query = GetCollection | GetSingle | GetSecondary | GetRelationship,
102+
103+
/// <summary>
104+
/// Represents the set of JSON:API endpoints to change resources and relationships.
105+
/// </summary>
23106
Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship,
24107

108+
/// <summary>
109+
/// Represents all of the JSON:API endpoints.
110+
/// </summary>
25111
All = Query | Command
26112
}

src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs

+86
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,106 @@ namespace JsonApiDotNetCore.SourceGenerators;
44
[Flags]
55
public enum JsonApiEndpointsCopy
66
{
7+
/// <summary>
8+
/// Represents none of the JSON:API endpoints.
9+
/// </summary>
710
None = 0,
11+
12+
/// <summary>
13+
/// Represents the endpoint to get a collection of primary resources. Example: <code><![CDATA[
14+
/// GET /articles HTTP/1.1
15+
/// ]]></code>
16+
/// </summary>
817
GetCollection = 1,
18+
19+
/// <summary>
20+
/// Represents the endpoint to get a single primary resource by ID. Example: <code><![CDATA[
21+
/// GET /articles/1 HTTP/1.1
22+
/// ]]></code>
23+
/// </summary>
924
GetSingle = 1 << 1,
25+
26+
/// <summary>
27+
/// Represents the endpoint to get a secondary resource or collection of secondary resources. Example:
28+
/// <code><![CDATA[
29+
/// GET /articles/1/author HTTP/1.1
30+
/// ]]></code> Example: <code><![CDATA[
31+
/// GET /articles/1/revisions HTTP/1.1
32+
/// ]]></code>
33+
/// </summary>
1034
GetSecondary = 1 << 2,
35+
36+
/// <summary>
37+
/// Represents the endpoint to get a relationship value. Example: <code><![CDATA[
38+
/// GET /articles/1/relationships/author HTTP/1.1
39+
/// ]]></code> Example:
40+
/// <code><![CDATA[
41+
/// GET /articles/1/relationships/revisions HTTP/1.1
42+
/// ]]></code>
43+
/// </summary>
1144
GetRelationship = 1 << 3,
45+
46+
/// <summary>
47+
/// Represents the endpoint to create a new resource with attributes, relationships or both. Example:
48+
/// <code><![CDATA[
49+
/// POST /articles HTTP/1.1
50+
/// ]]></code>
51+
/// </summary>
1252
Post = 1 << 4,
53+
54+
/// <summary>
55+
/// Represents the endpoint to add resources to a to-many relationship. Example: <code><![CDATA[
56+
/// POST /articles/1/revisions HTTP/1.1
57+
/// ]]></code>
58+
/// </summary>
1359
PostRelationship = 1 << 5,
60+
61+
/// <summary>
62+
/// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example:
63+
/// <code><![CDATA[
64+
/// PATCH /articles/1
65+
/// ]]></code>
66+
/// </summary>
1467
Patch = 1 << 6,
68+
69+
/// <summary>
70+
/// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example:
71+
/// <code><![CDATA[
72+
/// PATCH /articles/1/relationships/author HTTP/1.1
73+
/// ]]></code> Example:
74+
/// <code><![CDATA[
75+
/// PATCH /articles/1/relationships/revisions HTTP/1.1
76+
/// ]]></code>
77+
/// </summary>
1578
PatchRelationship = 1 << 7,
79+
80+
/// <summary>
81+
/// Represents the endpoint to delete an existing resource. Example: <code><![CDATA[
82+
/// DELETE /articles/1
83+
/// ]]></code>
84+
/// </summary>
1685
Delete = 1 << 8,
86+
87+
/// <summary>
88+
/// Represents the endpoint to remove resources from a to-many relationship. Example:
89+
/// <code><![CDATA[
90+
/// DELETE /articles/1/relationships/revisions
91+
/// ]]></code>
92+
/// </summary>
1793
DeleteRelationship = 1 << 9,
1894

95+
/// <summary>
96+
/// Represents the set of JSON:API endpoints to query resources and relationships.
97+
/// </summary>
1998
Query = GetCollection | GetSingle | GetSecondary | GetRelationship,
99+
100+
/// <summary>
101+
/// Represents the set of JSON:API endpoints to change resources and relationships.
102+
/// </summary>
20103
Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship,
21104

105+
/// <summary>
106+
/// Represents all of the JSON:API endpoints.
107+
/// </summary>
22108
All = Query | Command
23109
}

0 commit comments

Comments
 (0)