Skip to content

Instantly share code, notes, and snippets.

@PandiyanCool
Created October 27, 2018 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PandiyanCool/b71690451d6e8945d260f6e11043d359 to your computer and use it in GitHub Desktop.
Save PandiyanCool/b71690451d6e8945d260f6e11043d359 to your computer and use it in GitHub Desktop.
using Microsoft.AspNetCore.Mvc.ApiExplorer;
namespace Microsoft.AspNetCore.Mvc
{
public static class DefaultApiConventions
{
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(201)]
[ProducesResponseType(400)]
public static void Create([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object model);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(200)]
[ProducesResponseType(404)]
[ProducesResponseType(400)]
public static void Delete([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(204)]
[ProducesResponseType(404)]
[ProducesResponseType(400)]
public static void Edit([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id, [ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object model);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(200)]
[ProducesResponseType(404)]
public static void Find([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(200)]
[ProducesResponseType(404)]
public static void Get([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(201)]
[ProducesResponseType(400)]
public static void Post([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object model);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(204)]
[ProducesResponseType(404)]
[ProducesResponseType(400)]
public static void Put([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id, [ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object model);
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
[ProducesDefaultResponseType]
[ProducesResponseType(204)]
[ProducesResponseType(404)]
[ProducesResponseType(400)]
public static void Update([ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object id, [ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)][ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)] object model);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment