46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace Kreta.Client.ClientBase.Response
|
|
{
|
|
public class GetTokenResponse : IResponse
|
|
{
|
|
public GetTokenResponse() { }
|
|
|
|
public GetTokenResponse(string error)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(error))
|
|
{
|
|
throw new ArgumentNullException(nameof(error));
|
|
}
|
|
|
|
Error = error;
|
|
}
|
|
|
|
public GetTokenResponse(string accessToken, int expiresIn)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(accessToken))
|
|
{
|
|
throw new ArgumentNullException(nameof(accessToken));
|
|
}
|
|
|
|
if (expiresIn < 1)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(expiresIn));
|
|
}
|
|
|
|
IsSuccess = true;
|
|
AccessToken = accessToken;
|
|
ExpiresIn = expiresIn;
|
|
}
|
|
|
|
public bool IsSuccess { get; }
|
|
|
|
public string AccessToken { get; }
|
|
|
|
public int ExpiresIn { get; }
|
|
|
|
public string Error { get; }
|
|
|
|
public bool TryAgain { get; }
|
|
}
|
|
}
|