NWNX:EE  8193.36.12
nwnx_httpclient.nss
Go to the documentation of this file.
1 #include "nwnx"
6 
7 const string NWNX_HTTPClient = "NWNX_HTTPClient";
8 
21 
32 
42 
45 {
47  string sTag;
48  string sHost;
49  string sPath;
50  string sData;
52  int nAuthType;
54  string sAuthPassword;
55  int nPort;
56  string sHeaders;
57 };
58 
63 
68 
70 
72 {
73  string sFunc = "SendRequest";
85  NWNX_CallFunction(NWNX_HTTPClient, sFunc);
86 
87  return NWNX_GetReturnValueInt();
88 }
89 
91 {
92 
93  string sFunc = "GetRequest";
94 
95  NWNX_PushArgumentInt(nRequestId);
96  NWNX_CallFunction(NWNX_HTTPClient, sFunc);
97 
98  struct NWNX_HTTPClient_Request s;
99 
111 
112  return s;
113 }
NWNX_GetReturnValueInt
int NWNX_GetReturnValueInt()
Returns the specified type from the c++ side.
Definition: nwnx.nss:94
NWNX_HTTPClient_Request::nRequestMethod
int nRequestMethod
A Request Type.
Definition: nwnx_httpclient.nss:46
NWNX_HTTPCLIENT_REQUEST_METHOD_GET
const int NWNX_HTTPCLIENT_REQUEST_METHOD_GET
Definition: nwnx_httpclient.nss:13
NWNX_HTTPCLIENT_AUTH_TYPE_DIGEST
const int NWNX_HTTPCLIENT_AUTH_TYPE_DIGEST
Definition: nwnx_httpclient.nss:39
NWNX_HTTPCLIENT_REQUEST_METHOD_OPTION
const int NWNX_HTTPCLIENT_REQUEST_METHOD_OPTION
Definition: nwnx_httpclient.nss:18
NWNX_HTTPClient_Request
A structure for an HTTP Client Request.
Definition: nwnx_httpclient.nss:44
NWNX_HTTPCLIENT_REQUEST_METHOD_POST
const int NWNX_HTTPCLIENT_REQUEST_METHOD_POST
Definition: nwnx_httpclient.nss:14
NWNX_HTTPClient_SendRequest
int NWNX_HTTPClient_SendRequest(struct NWNX_HTTPClient_Request s)
Sends an http method to the given host.
Definition: nwnx_httpclient.nss:71
NWNX_HTTPCLIENT_REQUEST_METHOD_PUT
const int NWNX_HTTPCLIENT_REQUEST_METHOD_PUT
Definition: nwnx_httpclient.nss:17
NWNX_HTTPCLIENT_REQUEST_METHOD_DELETE
const int NWNX_HTTPCLIENT_REQUEST_METHOD_DELETE
Definition: nwnx_httpclient.nss:15
NWNX_HTTPCLIENT_REQUEST_METHOD_HEAD
const int NWNX_HTTPCLIENT_REQUEST_METHOD_HEAD
Definition: nwnx_httpclient.nss:19
NWNX_HTTPCLIENT_AUTH_TYPE_BEARER_TOKEN
const int NWNX_HTTPCLIENT_AUTH_TYPE_BEARER_TOKEN
Definition: nwnx_httpclient.nss:40
NWNX_HTTPCLIENT_CONTENT_TYPE_JSON
const int NWNX_HTTPCLIENT_CONTENT_TYPE_JSON
Definition: nwnx_httpclient.nss:28
NWNX_HTTPClient_Request::nContentType
int nContentType
A Content Type.
Definition: nwnx_httpclient.nss:51
NWNX_HTTPClient_GetRequest
struct NWNX_HTTPClient_Request NWNX_HTTPClient_GetRequest(int nRequestId)
Returns an NWNX_HTTP_Client_Request structure.
Definition: nwnx_httpclient.nss:90
NWNX_HTTPCLIENT_REQUEST_METHOD_PATCH
const int NWNX_HTTPCLIENT_REQUEST_METHOD_PATCH
Definition: nwnx_httpclient.nss:16
NWNX_CallFunction
void NWNX_CallFunction(string pluginName, string functionName)
Scripting interface to NWNX.
Definition: nwnx.nss:54
NWNX_GetReturnValueString
string NWNX_GetReturnValueString()
Returns the specified type from the c++ side.
Definition: nwnx.nss:109
NWNX_PushArgumentString
void NWNX_PushArgumentString(string value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:74
NWNX_HTTPClient_Request::sData
string sData
The data being sent.
Definition: nwnx_httpclient.nss:50
NWNX_HTTPClient_Request::sAuthUserOrToken
string sAuthUserOrToken
The authentication username or token.
Definition: nwnx_httpclient.nss:53
NWNX_HTTPCLIENT_AUTH_TYPE_BASIC
const int NWNX_HTTPCLIENT_AUTH_TYPE_BASIC
Definition: nwnx_httpclient.nss:38
NWNX_HTTPCLIENT_CONTENT_TYPE_HTML
const int NWNX_HTTPCLIENT_CONTENT_TYPE_HTML
Definition: nwnx_httpclient.nss:26
NWNX_PushArgumentInt
void NWNX_PushArgumentInt(int value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:59
NWNX_HTTPClient_Request::sHost
string sHost
The host domain name/IP address.
Definition: nwnx_httpclient.nss:48
NWNX_HTTPClient_Request::nAuthType
int nAuthType
An Authentication Type.
Definition: nwnx_httpclient.nss:52
NWNX_HTTPClient_Request::sHeaders
string sHeaders
Pipe (|) delimited header pairs, e.g. "User-Agent: My NWNX HTTP Client|Accept: application/vnd....
Definition: nwnx_httpclient.nss:56
NWNX_HTTPCLIENT_AUTH_TYPE_NONE
const int NWNX_HTTPCLIENT_AUTH_TYPE_NONE
Definition: nwnx_httpclient.nss:37
NWNX_HTTPClient_Request::sAuthPassword
string sAuthPassword
The authentication password (ignored if just using a token)
Definition: nwnx_httpclient.nss:54
NWNX_HTTPClient_Request::sPath
string sPath
The path for the url (include the leading /)
Definition: nwnx_httpclient.nss:49
NWNX_HTTPClient_Request::nPort
int nPort
The host port.
Definition: nwnx_httpclient.nss:55
NWNX_HTTPCLIENT_CONTENT_TYPE_XML
const int NWNX_HTTPCLIENT_CONTENT_TYPE_XML
Definition: nwnx_httpclient.nss:30
NWNX_HTTPCLIENT_CONTENT_TYPE_FORM_URLENCODED
const int NWNX_HTTPCLIENT_CONTENT_TYPE_FORM_URLENCODED
Definition: nwnx_httpclient.nss:29
NWNX_HTTPClient_Request::sTag
string sTag
A unique tag for this request.
Definition: nwnx_httpclient.nss:47
NWNX_HTTPCLIENT_CONTENT_TYPE_PLAINTEXT
const int NWNX_HTTPCLIENT_CONTENT_TYPE_PLAINTEXT
Definition: nwnx_httpclient.nss:27