forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApiResponse.cs
More file actions
41 lines (34 loc) · 1.11 KB
/
ApiResponse.cs
File metadata and controls
41 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//Copyright (c) Service Stack LLC. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
using System;
using System.Net;
namespace ServiceStack
{
public interface IApiResponseDescription
{
/// <summary>
/// The status code of a response
/// </summary>
int StatusCode { get; }
/// <summary>
/// The description of a response status code
/// </summary>
string Description { get; }
}
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class ApiResponseAttribute : AttributeBase, IApiResponseDescription
{
public int StatusCode { get; set; }
public string Description { get; set; }
public ApiResponseAttribute(HttpStatusCode statusCode, string description)
{
StatusCode = (int)statusCode;
Description = description;
}
public ApiResponseAttribute(int statusCode, string description)
{
StatusCode = statusCode;
Description = description;
}
}
}