static int QPYX__CreateUnityEngine_Networking_DownloadHandlerBuffer_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 0) { UnityEngine.Networking.DownloadHandlerBuffer QPYX_obj_YXQP = new UnityEngine.Networking.DownloadHandlerBuffer(); ToLua.PushSealed(L_YXQP, QPYX_obj_YXQP); return(1); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to ctor method: UnityEngine.Networking.DownloadHandlerBuffer.New")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
/// <summary> /// Create a HTTP web request based on the provided arguments and invokes a callback method which you provide /// to handle the reponse once the download is complete. /// </summary> /// <param name="endPoint">The specific endpoint to send the request to. Appends the domain value to the begining of this string to form the full URI.</param> /// <param name="callback">A public method to invoke which takes the web request once the download has /// completed.</param> /// <param name="method">The type of web request to make. GET by defualt.</param> /// <param name="input">Whatever data to pass in as an input to converted to JSON for the endpoint. Null by default.</param> /// <returns>Coroutine handle which yields the web request.</returns> public virtual IEnumerator HttpRequest(string endPoint, UnityAction <UnityWebRequest> callback, RequestMethod method = RequestMethod.GET, object input = null) { DownloadHandler downloader = new DownloadHandlerBuffer(); UnityWebRequest request; string uri = domain + endPoint; switch (method) { case RequestMethod.GET: request = new UnityWebRequest(uri); request.downloadHandler = downloader; break; case RequestMethod.POST: byte[] rawBody = new System.Text.UTF8Encoding().GetBytes(JsonUtility.ToJson(input)); UploadHandler uploader = new UploadHandlerRaw(rawBody); request = new UnityWebRequest(uri, Enum.GetName(typeof(RequestMethod), method), downloader, uploader); break; default: throw new Exception(string.Format("RequestMethod.{0} not supported. You can choose to extend this class and add your own custom support.", Enum.GetName(typeof(RequestMethod), method))); } if (useSecurityToken) { request.SetRequestHeader(securityTokenKey, securityTokenValue); } request.SetRequestHeader("Content-Type", "application/json"); yield return(request.SendWebRequest()); if (!IsResponsePositive(request.responseCode)) { throw new Exception(string.Format("Web request returned negative response: {0} {1} '{2}'", request.responseCode, GetNameOfResponseCode(request.responseCode), request.downloadHandler.text)); } callback.Invoke(request); }
static int _CreateUnityEngine_Networking_DownloadHandlerBuffer(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.Networking.DownloadHandlerBuffer obj = new UnityEngine.Networking.DownloadHandlerBuffer(); ToLua.PushSealed(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Networking.DownloadHandlerBuffer.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private extern static IntPtr Create(DownloadHandlerBuffer obj);
private void InternalCreateBuffer() { this.m_Ptr = DownloadHandlerBuffer.Create(this); }