diff --git a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs index a6d11e6093..b63bc2e096 100644 --- a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs +++ b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs @@ -2,25 +2,142 @@ namespace JsonApiDotNetCore.Controllers; -// IMPORTANT: An internal copy of this type exists in the SourceGenerators project. Keep these in sync when making changes. +/// +/// Lists the built-in JSON:API endpoints, described at https://jsonapi.org/format. +/// [PublicAPI] [Flags] public enum JsonApiEndpoints { + // IMPORTANT: An internal copy of this type exists in the JsonApiDotNetCore.SourceGenerators project. + // Keep them in sync when making changes. + + /// + /// Represents none of the JSON:API endpoints. + /// None = 0, + + /// + /// Represents the endpoint to get a collection of primary resources. + /// + /// Example endpoint: + /// + /// GetCollection = 1, + + /// + /// Represents the endpoint to get a single primary resource by ID. + /// + /// Example endpoint: + /// + /// GetSingle = 1 << 1, + + /// + /// Represents the endpoint to get a secondary resource or collection of secondary resources. + /// + /// Example endpoints: + /// + /// + /// GetSecondary = 1 << 2, + + /// + /// Represents the endpoint to get a relationship value. + /// + /// Example endpoints: + /// + /// + /// GetRelationship = 1 << 3, + + /// + /// Represents the endpoint to create a new resource with attributes, relationships, or both. + /// + /// Example endpoint: + /// + /// Post = 1 << 4, + + /// + /// Represents the endpoint to add resources to a to-many relationship. + /// + /// Example endpoint: + /// + /// PostRelationship = 1 << 5, + + /// + /// Represents the endpoint to update the attributes and/or relationships of an existing resource. + /// + /// Example endpoint: + /// + /// Patch = 1 << 6, + + /// + /// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. + /// + /// Example endpoints: + /// + /// + /// PatchRelationship = 1 << 7, + + /// + /// Represents the endpoint to delete an existing resource. + /// + /// Example endpoint: + /// + /// Delete = 1 << 8, + + /// + /// Represents the endpoint to remove resources from a to-many relationship. + /// + /// Example endpoint: + /// + /// DeleteRelationship = 1 << 9, + /// + /// Represents the set of JSON:API endpoints to query resources and relationships. + /// Query = GetCollection | GetSingle | GetSecondary | GetRelationship, + + /// + /// Represents the set of JSON:API endpoints to change resources and relationships. + /// Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship, + /// + /// Represents all JSON:API endpoints. + /// All = Query | Command } diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs index 56e924317d..45b1903994 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs +++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs @@ -2,25 +2,142 @@ namespace JsonApiDotNetCore.SourceGenerators; -// IMPORTANT: A copy of this type exists in the JsonApiDotNetCore project. Keep these in sync when making changes. +/// +/// Lists the built-in JSON:API endpoints, described at https://jsonapi.org/format. +/// [PublicAPI] [Flags] public enum JsonApiEndpointsCopy { + // IMPORTANT: A copy of this type exists in the JsonApiDotNetCore.Annotations project. + // Keep them in sync when making changes. + + /// + /// Represents none of the JSON:API endpoints. + /// None = 0, + + /// + /// Represents the endpoint to get a collection of primary resources. + /// + /// Example endpoint: + /// + /// GetCollection = 1, + + /// + /// Represents the endpoint to get a single primary resource by ID. + /// + /// Example endpoint: + /// + /// GetSingle = 1 << 1, + + /// + /// Represents the endpoint to get a secondary resource or collection of secondary resources. + /// + /// Example endpoints: + /// + /// + /// GetSecondary = 1 << 2, + + /// + /// Represents the endpoint to get a relationship value. + /// + /// Example endpoints: + /// + /// + /// GetRelationship = 1 << 3, + + /// + /// Represents the endpoint to create a new resource with attributes, relationships, or both. + /// + /// Example endpoint: + /// + /// Post = 1 << 4, + + /// + /// Represents the endpoint to add resources to a to-many relationship. + /// + /// Example endpoint: + /// + /// PostRelationship = 1 << 5, + + /// + /// Represents the endpoint to update the attributes and/or relationships of an existing resource. + /// + /// Example endpoint: + /// + /// Patch = 1 << 6, + + /// + /// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. + /// + /// Example endpoints: + /// + /// + /// PatchRelationship = 1 << 7, + + /// + /// Represents the endpoint to delete an existing resource. + /// + /// Example endpoint: + /// + /// Delete = 1 << 8, + + /// + /// Represents the endpoint to remove resources from a to-many relationship. + /// + /// Example endpoint: + /// + /// DeleteRelationship = 1 << 9, + /// + /// Represents the set of JSON:API endpoints to query resources and relationships. + /// Query = GetCollection | GetSingle | GetSecondary | GetRelationship, + + /// + /// Represents the set of JSON:API endpoints to change resources and relationships. + /// Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship, + /// + /// Represents all JSON:API endpoints. + /// All = Query | Command } diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs index 6cc04043f3..bdea72d6a8 100644 --- a/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs +++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs @@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors; /// -/// Processes a single operation to create a new resource with attributes, relationships or both. +/// Processes a single operation to create a new resource with attributes, relationships, or both. /// /// /// The resource type. diff --git a/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs b/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs index aa91527b24..5a12d9429d 100644 --- a/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs +++ b/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs @@ -165,7 +165,7 @@ public virtual async Task GetSecondaryAsync([DisallowNull] TId id } /// - /// Gets a relationship value, which can be a null, a single object or a collection. + /// Gets a relationship value, which can be null, a single object or a collection. /// /// Example endpoints: GetRelationshipAsync([DisallowNull] TId } /// - /// Creates a new resource with attributes, relationships or both. + /// Creates a new resource with attributes, relationships, or both. /// /// Example endpoint: - /// Create a new resource with attributes, relationships or both. + /// Create a new resource with attributes, relationships, or both. /// CreateResource, diff --git a/src/JsonApiDotNetCore/Services/ICreateService.cs b/src/JsonApiDotNetCore/Services/ICreateService.cs index 7a75d6d4af..ffd4cb46c8 100644 --- a/src/JsonApiDotNetCore/Services/ICreateService.cs +++ b/src/JsonApiDotNetCore/Services/ICreateService.cs @@ -7,7 +7,7 @@ public interface ICreateService where TResource : class, IIdentifiable { /// - /// Handles a JSON:API request to create a new resource with attributes, relationships or both. + /// Handles a JSON:API request to create a new resource with attributes, relationships, or both. /// Task CreateAsync(TResource resource, CancellationToken cancellationToken); }