Ejemplo n.º 1
0
        public static T WithValidation <T>(this IApiResponse <T> source)
        {
            if (source.IsSuccessful)
            {
                return(source.Record);
            }
            if (source.StatusCode == HttpStatusCode.Unauthorized)
            {
                throw new HelpScoutAuthenticationException("Authentication Failed: Invalid Token or expired one.");
            }

            throw source.ToException($"Errored status:{source.StatusCode}");
        }