XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
118 stars 119 forks source link

GetAssetTypesAsync return null #497

Open ThomasLoSG opened 6 months ago

ThomasLoSG commented 6 months ago
Exception ExceptionFactory(string methodName, IApiResponse response)
{
    var statusCode = (int)response.StatusCode;
    switch (statusCode)
    {
        case 400:
            return new XeroApiException(statusCode, $"Xero API 400 error calling {(object)methodName} :{(object)response.Content.ToString()}", response.Headers, response.Content);
        default:
            return statusCode > 400 ? new XeroApiException(statusCode,
        $"Xero API error calling {(object)methodName}: {(object)response.Content.ToString()}", response.Headers, response.Content) : (Exception)null;
    }
}
var faInstance = new AssetApi()
{
    ExceptionFactory = ExceptionFactory
};

List<AssetType> ats = null;
Task.Run(async () =>
{
    try
    {        
        ats = await faInstance.GetAssetTypesAsync(token.AccessToken, tenant.TenantId.ToString());
    }
    catch (XeroApiException xe)
    {
    }
}).Wait();

No error generated but ats remain null

github-actions[bot] commented 6 months ago

PETOSS-378

github-actions[bot] commented 6 months ago

Thanks for raising an issue, a ticket has been created to track your request