Class ApiResponse
API Response
Inherited Members
Namespace: Unity.Services.Apis
Assembly: Unity.Services.Apis.dll
Syntax
public class ApiResponse
Constructors
ApiResponse()
Initializes a new instance of the Api
Declaration
public ApiResponse()
Properties
Content
The content
Declaration
public string Content { get; }
Property Value
Type | Description |
---|---|
string |
ErrorText
Gets or sets any error text defined by the calling client.
Declaration
public string ErrorText { get; }
Property Value
Type | Description |
---|---|
string |
ErrorType
Gets the error type
Declaration
public ApiErrorType ErrorType { get; }
Property Value
Type | Description |
---|---|
Api |
The error type. |
Headers
Gets or sets the HTTP headers
Declaration
public Dictionary<string, string> Headers { get; }
Property Value
Type | Description |
---|---|
Dictionary<string, string> | HTTP headers |
IsSuccessful
If the operation was successful
Declaration
public bool IsSuccessful { get; }
Property Value
Type | Description |
---|---|
bool |
StatusCode
Gets or sets the status code (HTTP status code)
Declaration
public int StatusCode { get; }
Property Value
Type | Description |
---|---|
int | The status code. |
Methods
EnsureSuccessful()
Validates that the response was successful
Declaration
public void EnsureSuccessful()
Exceptions
Type | Condition |
---|---|
Api |
Thrown if the response was not successful |
GetContentAs<T>()
Attempts to convert the content to the provided format. Returns the default value if incompatible.
Declaration
public T GetContentAs<T>()
Returns
Type | Description |
---|---|
T | The converted content or the default value for the type. |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize to |