Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document JsonApiEndpoints enum #1301

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,105 @@ namespace JsonApiDotNetCore.Controllers;
public enum JsonApiEndpoints
{
None = 0,
verdie-g marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Endpoint to get a collection of primary resources.
/// </summary>
/// <example>
/// <code><![CDATA[GET /articles]]></code>
/// </example>
verdie-g marked this conversation as resolved.
Show resolved Hide resolved
GetCollection = 1,

/// <summary>
/// Endpoint to get a single primary resource by ID.
/// </summary>
/// <example>
/// <code><![CDATA[GET /articles/1]]></code>
/// </example>
GetSingle = 1 << 1,

/// <summary>
/// Endpoint to get a secondary resource or collection of secondary resources.
/// </summary>
/// <example>
/// <code><![CDATA[GET /articles/1/author]]></code>
/// </example>
GetSecondary = 1 << 2,

/// <summary>
/// Endpoint to get a relationship value, which can be a <c>null</c>, a single object or a collection.
verdie-g marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
/// <example>
/// <code><![CDATA[GET /articles/1/relationships/author]]></code>
/// </example>
/// <example>
/// <code><![CDATA[GET /articles/1/relationships/revisions]]></code>
/// </example>
GetRelationship = 1 << 3,

/// <summary>
/// Endpoint to creates a new resource with attributes, relationships or both.
/// </summary>
/// <example>
/// <code><![CDATA[POST /articles]]></code>
/// </example>
Post = 1 << 4,

/// <summary>
/// Endpoint to add resources to a to-many relationship.
/// </summary>
/// <example>
/// <code><![CDATA[POST /articles/1/revisions]]></code>
/// </example>
PostRelationship = 1 << 5,

/// <summary>
/// Endpoint to update the attributes and/or relationships of an existing resource.
/// </summary>
/// <example>
/// <code><![CDATA[PATCH /articles/1]]></code>
/// </example>
Patch = 1 << 6,

/// <summary>
/// Endpoint to perform a complete replacement of a relationship on an existing resource.
/// </summary>
/// <example>
/// <code><![CDATA[PATCH /articles/1/relationships/author]]></code>
/// </example>
/// <example>
/// <code><![CDATA[PATCH /articles/1/relationships/revisions]]></code>
/// </example>
PatchRelationship = 1 << 7,

/// <summary>
/// Endpoint to delete an existing resource.
/// </summary>
/// <example>
/// <code><![CDATA[DELETE /articles/1]]></code>
/// </example>
Delete = 1 << 8,

/// <summary>
/// Endpoint to remove resources from a to-many relationship.
/// </summary>
/// <example>
/// <code><![CDATA[DELETE /articles/1/relationships/revisions]]></code>
/// </example>
DeleteRelationship = 1 << 9,

/// <summary>
/// All read-only endpoints.
verdie-g marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
Query = GetCollection | GetSingle | GetSecondary | GetRelationship,

/// <summary>
/// All write endpoints.
verdie-g marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship,

/// <summary>
/// All endpoints.
verdie-g marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
All = Query | Command
}