NWNX:EE  8193.37.17
nwnx_httpclient.nss
Go to the documentation of this file.
1 
6 const string NWNX_HTTPClient = "NWNX_HTTPClient";
7 
20 
31 
41 
44 {
46  string sTag;
47  string sCustom1;
48  string sCustom2;
49  string sCustom3;
50  string sHost;
51  string sPath;
52  string sData;
54  int nAuthType;
56  string sAuthPassword;
57  int nPort;
58  string sHeaders;
59 };
60 
65 
70 
72 
74 {
75  NWNXPushString(s.sCustom3);
76  NWNXPushString(s.sCustom2);
77  NWNXPushString(s.sCustom1);
78  NWNXPushString(s.sHeaders);
79  NWNXPushInt(s.nPort);
80  NWNXPushString(s.sAuthPassword);
81  NWNXPushString(s.sAuthUserOrToken);
82  NWNXPushInt(s.nAuthType);
83  NWNXPushString(s.sData);
84  NWNXPushInt(s.nContentType);
85  NWNXPushString(s.sPath);
86  NWNXPushString(s.sHost);
87  NWNXPushInt(s.nRequestMethod);
88  NWNXPushString(s.sTag);
89  NWNXCall(NWNX_HTTPClient, "SendRequest");
90  return NWNXPopInt();
91 }
92 
94 {
95  NWNXPushInt(nRequestId);
96  NWNXCall(NWNX_HTTPClient, "GetRequest");
97 
98  struct NWNX_HTTPClient_Request s;
99 
100  s.sTag = NWNXPopString();
101  s.nRequestMethod = NWNXPopInt();
102  s.sHost = NWNXPopString();
103  s.sPath = NWNXPopString();
104  s.nContentType = NWNXPopInt();
105  s.sData = NWNXPopString();
106  s.nAuthType = NWNXPopInt();
107  s.sAuthUserOrToken = NWNXPopString();
108  s.sAuthPassword = NWNXPopString();
109  s.nPort = NWNXPopInt();
110  s.sHeaders = NWNXPopString();
111  s.sCustom1 = NWNXPopString();
112  s.sCustom2 = NWNXPopString();
113  s.sCustom3 = NWNXPopString();
114 
115  return s;
116 }
const int NWNX_HTTPCLIENT_AUTH_TYPE_DIGEST
const int NWNX_HTTPCLIENT_REQUEST_METHOD_PUT
const int NWNX_HTTPCLIENT_REQUEST_METHOD_OPTION
struct NWNX_HTTPClient_Request NWNX_HTTPClient_GetRequest(int nRequestId)
Returns an NWNX_HTTP_Client_Request structure.
const int NWNX_HTTPCLIENT_CONTENT_TYPE_JSON
const int NWNX_HTTPCLIENT_AUTH_TYPE_BEARER_TOKEN
const int NWNX_HTTPCLIENT_CONTENT_TYPE_FORM_URLENCODED
const int NWNX_HTTPCLIENT_REQUEST_METHOD_DELETE
const int NWNX_HTTPCLIENT_CONTENT_TYPE_XML
const int NWNX_HTTPCLIENT_REQUEST_METHOD_POST
const int NWNX_HTTPCLIENT_CONTENT_TYPE_HTML
int NWNX_HTTPClient_SendRequest(struct NWNX_HTTPClient_Request s)
Sends an http method to the given host.
const int NWNX_HTTPCLIENT_AUTH_TYPE_BASIC
const int NWNX_HTTPCLIENT_REQUEST_METHOD_HEAD
const int NWNX_HTTPCLIENT_CONTENT_TYPE_PLAINTEXT
const int NWNX_HTTPCLIENT_REQUEST_METHOD_PATCH
const int NWNX_HTTPCLIENT_AUTH_TYPE_NONE
const int NWNX_HTTPCLIENT_REQUEST_METHOD_GET
A structure for an HTTP Client Request.
string sData
The data being sent.
string sCustom2
A custom value.
int nContentType
A Content Type.
string sHost
The host domain name/IP address.
int nRequestMethod
A Request Type.
string sAuthPassword
The authentication password (ignored if just using a token)
string sHeaders
Pipe (|) delimited header pairs, e.g. "User-Agent: My NWNX HTTP Client|Accept: application/vnd....
string sCustom3
A custom value.
string sTag
A unique tag for this request.
int nAuthType
An Authentication Type.
string sPath
The path for the url (include the leading /)
int nPort
The host port.
string sCustom1
A custom value.
string sAuthUserOrToken
The authentication username or token.