54 lines
2.4 KiB
C#
54 lines
2.4 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
|
|
|
namespace Microsoft.AspNetCore.Mvc
|
|
{
|
|
public static class DefaultApiConventions
|
|
{
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
[ProducesDefaultResponseType]
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
|
|
public static void Get(
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)]
|
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
|
object id) { }
|
|
|
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
[ProducesDefaultResponseType]
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
|
|
public static void Post(
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)]
|
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
|
object model) { }
|
|
|
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
[ProducesDefaultResponseType]
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
|
|
public static void Put(
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)]
|
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
|
object id,
|
|
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Any)]
|
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
|
object model) { }
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
[ProducesDefaultResponseType]
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Prefix)]
|
|
public static void Delete(
|
|
[ApiConventionNameMatch(ApiConventionNameMatchBehavior.Suffix)]
|
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
|
object id) { }
|
|
}
|
|
}
|