Class RESTResponse
Encapsulates the response format for all REST requests.
Assembly: WMServer.dll
Syntax
public class RESTResponse
Fields
Fail
Declaration
public const string Fail = "Fail"
Field Value
HTTPStatus
Declaration
public const string HTTPStatus = "HTTPStatus"
Field Value
Success
Declaration
public const string Success = "Success"
Field Value
Properties
Duration
The time spent processing the request in microseconds.
Declaration
public TimeSpan Duration { get; set; }
Property Value
Message
The error Message if the Status property is not "OK" Null otherwise.
Declaration
public string? Message { get; set; }
Property Value
RequestTime
The time the request was received.
Declaration
public DateTime RequestTime { get; set; }
Property Value
Status
Status returned by the response. Must be "OK" or "Error".
Declaration
public string Status { get; set; }
Property Value
URL
The URL of the request, the response to which will include this object.
Declaration
public string URL { get; set; }
Property Value
Value
The Value returned by the response. Null if the Status property is not "OK".
Declaration
public object? Value { get; set; }
Property Value
Methods
Error(ControllerBase, Exception)
Declaration
public static ObjectResult Error(ControllerBase ctrl, Exception ex)
Parameters
Returns
Error(ControllerBase, string, int)
Declaration
public static ObjectResult Error(ControllerBase ctrl, string message, int code)
Parameters
Returns
OK(ControllerBase, object?, int)
Declaration
public static ObjectResult OK(ControllerBase ctrl, object? val, int code = -1)
Parameters
Returns
RESTError(string)
Declaration
public static RESTResponse RESTError(string message)
Parameters
Type |
Name |
Description |
string |
message |
|
Returns
RESTSuccess(object)
Declaration
public static RESTResponse RESTSuccess(object val)
Parameters
Type |
Name |
Description |
object |
val |
|
Returns