/// <summary> /// Get a limitation for a feature and a user /// </summary> public static ResponseEx TryGetLimitation(string keyFeature, string keyUser, out FeatureV2 feature) { return Current.TryGetLimitation(keyFeature, keyUser, out feature); }
/// <summary> /// Get a limitation for a feature and a user /// </summary> public ResponseEx TryGetLimitation(string keyFeature, string keyUser, out FeatureV2 feature) { ResponseEx result = null; feature = null; // build the url string messageError; var url = LtbUrl.TryBuild(out messageError, LtbResource.LimitationByUserByFeature, keyUser, keyFeature); // if succeeded if(string.IsNullOrEmpty(messageError)) { // create the request and send it result = RequestFluent.Create(url) .ContentType(LtbConstants.Json) .BasicAuthentication(LtbConstants.KeyBusiness, LtbConstants.KeyApi) .Send(); // if we have a response if((result != null) // with a body && (result.HasBody)) { // get the content from the response body feature = result.GetBodyAsJson<FeatureV2>(); } } // if url building failed else result = ResponseEx.Failure(url, messageError); return result; }