HTTPRequest.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="HTTPRequest" inherits="Node" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. A Node with the ability to send HTTP requests.
  5. </brief_description>
  6. <description>
  7. A Node with the ability to send HTTP requests. Uses a [HTTPClient] internally, supports HTTPS.
  8. Can be used to make HTTP requests or download files via HTTP.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="cancel_request">
  16. <return type="void">
  17. </return>
  18. <description>
  19. Cancel the current request.
  20. </description>
  21. </method>
  22. <method name="get_body_size" qualifiers="const">
  23. <return type="int">
  24. </return>
  25. <description>
  26. Return the response body length.
  27. </description>
  28. </method>
  29. <method name="get_body_size_limit" qualifiers="const">
  30. <return type="int">
  31. </return>
  32. <description>
  33. Return current body size limit.
  34. </description>
  35. </method>
  36. <method name="get_download_file" qualifiers="const">
  37. <return type="String">
  38. </return>
  39. <description>
  40. Return the file this request will download into.
  41. </description>
  42. </method>
  43. <method name="get_downloaded_bytes" qualifiers="const">
  44. <return type="int">
  45. </return>
  46. <description>
  47. Return the amount of bytes this HTTPRequest downloaded.
  48. </description>
  49. </method>
  50. <method name="get_http_client_status" qualifiers="const">
  51. <return type="int" enum="HTTPClient.Status">
  52. </return>
  53. <description>
  54. Return the current status of the underlying [HTTPClient].
  55. </description>
  56. </method>
  57. <method name="get_max_redirects" qualifiers="const">
  58. <return type="int">
  59. </return>
  60. <description>
  61. Return the maximum amount of redirects that will be followed.
  62. </description>
  63. </method>
  64. <method name="is_using_threads" qualifiers="const">
  65. <return type="bool">
  66. </return>
  67. <description>
  68. Whether this request is using threads.
  69. </description>
  70. </method>
  71. <method name="request">
  72. <return type="int" enum="Error">
  73. </return>
  74. <argument index="0" name="url" type="String">
  75. </argument>
  76. <argument index="1" name="custom_headers" type="PoolStringArray" default="PoolStringArray( )">
  77. </argument>
  78. <argument index="2" name="ssl_validate_domain" type="bool" default="true">
  79. </argument>
  80. <argument index="3" name="method" type="int" enum="HTTPClient.Method" default="0">
  81. </argument>
  82. <argument index="4" name="request_data" type="String" default="&quot;&quot;">
  83. </argument>
  84. <description>
  85. </description>
  86. </method>
  87. <method name="set_body_size_limit">
  88. <return type="void">
  89. </return>
  90. <argument index="0" name="bytes" type="int">
  91. </argument>
  92. <description>
  93. Set the response body size limit.
  94. </description>
  95. </method>
  96. <method name="set_download_file">
  97. <return type="void">
  98. </return>
  99. <argument index="0" name="path" type="String">
  100. </argument>
  101. <description>
  102. Set the file to download into. Outputs the response body into the file.
  103. </description>
  104. </method>
  105. <method name="set_max_redirects">
  106. <return type="void">
  107. </return>
  108. <argument index="0" name="amount" type="int">
  109. </argument>
  110. <description>
  111. Set the maximum amount of redirects the request will follow.
  112. </description>
  113. </method>
  114. <method name="set_use_threads">
  115. <return type="void">
  116. </return>
  117. <argument index="0" name="enable" type="bool">
  118. </argument>
  119. <description>
  120. Make this HTTPRequest use threads.
  121. </description>
  122. </method>
  123. </methods>
  124. <members>
  125. <member name="body_size_limit" type="int" setter="set_body_size_limit" getter="get_body_size_limit">
  126. </member>
  127. <member name="max_redirects" type="int" setter="set_max_redirects" getter="get_max_redirects">
  128. </member>
  129. <member name="use_threads" type="bool" setter="set_use_threads" getter="is_using_threads">
  130. </member>
  131. </members>
  132. <signals>
  133. <signal name="request_completed">
  134. <argument index="0" name="result" type="int">
  135. </argument>
  136. <argument index="1" name="response_code" type="int">
  137. </argument>
  138. <argument index="2" name="headers" type="PoolStringArray">
  139. </argument>
  140. <argument index="3" name="body" type="PoolByteArray">
  141. </argument>
  142. <description>
  143. This signal is emitted upon request completion.
  144. </description>
  145. </signal>
  146. </signals>
  147. <constants>
  148. <constant name="RESULT_SUCCESS" value="0">
  149. Request successful.
  150. </constant>
  151. <constant name="RESULT_CHUNKED_BODY_SIZE_MISMATCH" value="1">
  152. </constant>
  153. <constant name="RESULT_CANT_CONNECT" value="2">
  154. Request failed while connecting.
  155. </constant>
  156. <constant name="RESULT_CANT_RESOLVE" value="3">
  157. Request failed while resolving.
  158. </constant>
  159. <constant name="RESULT_CONNECTION_ERROR" value="4">
  160. Request failed due to connection(read/write) error.
  161. </constant>
  162. <constant name="RESULT_SSL_HANDSHAKE_ERROR" value="5">
  163. Request failed on SSL handshake.
  164. </constant>
  165. <constant name="RESULT_NO_RESPONSE" value="6">
  166. Request does not have a response(yet).
  167. </constant>
  168. <constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7">
  169. Request exceded its maximum size limit, see [method set_body_size_limit].
  170. </constant>
  171. <constant name="RESULT_REQUEST_FAILED" value="8">
  172. Request failed. (unused)
  173. </constant>
  174. <constant name="RESULT_DOWNLOAD_FILE_CANT_OPEN" value="9">
  175. HTTPRequest couldn't open the download file.
  176. </constant>
  177. <constant name="RESULT_DOWNLOAD_FILE_WRITE_ERROR" value="10">
  178. HTTPRequest couldn't write to the download file.
  179. </constant>
  180. <constant name="RESULT_REDIRECT_LIMIT_REACHED" value="11">
  181. Request reached its maximum redirect limit, see [method set_max_redirects].
  182. </constant>
  183. </constants>
  184. </class>