/// <summary> /// Returns the response object used by a REST API. /// This method should only be used inside the OnBeforeResponseAdvanced callback of a REST API. /// </summary> /// <returns>The REST API response, or null when used outside the OnBeforeResponseAdvanced callback.</returns> public static RestResponse GetCurrent() { var responseContext = ResponseContext.GetCurrent(); if (responseContext != null) { return(new RestResponse(responseContext)); } else { return(null); // not inside of an OnBeforeResponseAdvanced callback. } }