docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ApiResponse

    API Response

    Inheritance
    object
    ApiResponse
    ApiResponse<T>
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Services.Apis.Shared
    Assembly: solution.dll
    Syntax
    public class ApiResponse

    Constructors

    ApiResponse()

    Initializes a new instance of the ApiResponse class.

    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
    ApiErrorType

    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
    ApiException

    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

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)