/// <summary> /// Processes a request into a response. /// </summary> public ApiResponse ProcessRequest(ApiRequest request) { Initialize(request); ApiResponse response = null; try { response = new ApiResponse(AuthUser, request); bool success = ProcessCoreFunctions(request, response); if (!success) success = ProcessApplicationFunctions(request, response); if (!success) { response.Status = MethodStatus.Fail; response.ErrorMessages.Add("Method not found."); } } catch { response = new ApiResponse(null, request); response.Status = MethodStatus.Fail; response.ErrorMessages.Add("An exception has occurred."); } return response; }
/// <summary> /// Processes any core functions. /// </summary> private bool ProcessCoreFunctions(ApiRequest request, ApiResponse response) { if (request.Function.Equals(CoreFunctions.AddressGetClientAddresses)) { response.DataObject = PublicLogicManager.Address.GetClientAddresses(); return true; } return false; }
/// <summary> /// Processes application specific functions. /// </summary> protected abstract bool ProcessApplicationFunctions(ApiRequest request, ApiResponse response);