Qore HttpClientDataProvider Module Reference 1.0
Loading...
Searching...
No Matches
HttpClientDataProvider.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
26namespace HttpClientDataProvider {
28class HttpClientDataProvider : public AbstractDataProvider {
29
30public:
32 const ProviderInfo = <DataProviderInfo>{
33 "type": "HttpClientDataProvider",
34 "constructor_options": ConstructorOptions,
35 "supports_children": True,
36 "children_can_support_apis": True,
37 "children_can_support_records": False,
38 "children_can_support_observers": False,
39 };
40
42 const ConstructorOptions = {
43 "assume_encoding": <DataProviderOptionInfo>{
44 "type": AbstractDataProviderType::get(StringType),
45 "desc": "Assumes the given encoding if the server does not send a `charset` value",
46 },
47 "connect_timeout": <DataProviderOptionInfo>{
48 "type": AbstractDataProviderType::get(IntType),
49 "desc": "The connection timeout to use in milliseconds (default: 45 seconds)",
50 "default_value": 45000,
51 },
52 "error_passthru": <DataProviderOptionInfo>{
53 "type": AbstractDataProviderType::get(BoolType),
54 "desc": "If `True` then HTTP status codes indicating errors will not cause an "
55 "`HTTP-CLIENT-RECEIVE-ERROR` exception to be raised, rather such responses will be "
56 "passed through to the caller like any other response",
57 "default_value": False,
58 },
59 "http_version": <DataProviderOptionInfo>{
60 "type": AbstractDataProviderType::get(StringType),
61 "desc": "HTTP version to use (`1.0` or `1.1`, defaults to `1.1`)",
62 "default_value": "1.1",
63 "allowed_values": (
64 <AllowedValueInfo>{
65 "value": "1.0",
66 "desc": "Use HTTP version \"1.0\"",
67 }, <AllowedValueInfo>{
68 "value": "1.1",
69 "desc": "Use HTTP version \"1.1\" (the default)",
70 },
71 ),
72 },
73 "max_redirects": <DataProviderOptionInfo>{
74 "type": AbstractDataProviderType::get(IntType),
75 "desc": "Maximum redirects to support",
76 },
77 "proxy": <DataProviderOptionInfo>{
78 "type": AbstractDataProviderType::get(StringType),
79 "desc": "The proxy URL to use",
80 },
81 "redirect_passthru": <DataProviderOptionInfo>{
82 "type": AbstractDataProviderType::get(BoolType),
83 "desc": "if `True` then redirect responses will be passed to the caller instead of processed",
84 "default_value": False,
85 },
86 "ssl_cert_der": <DataProviderOptionInfo>{
87 "type": AbstractDataProviderType::get(BoolType),
88 "desc": "If `True` then the data represented by `ssl_cert_location` will be assumed to be in binary "
89 "DER format",
90 "default_value": False,
91 },
92 "ssl_cert_location": <DataProviderOptionInfo>{
93 "type": AbstractDataProviderType::get(StringType, NOTHING, {
94 DTT_FromFile: True,
95 DTT_FromLocation: True,
96 }),
97 "desc": "A path or location to an X.509 client certificate file",
98 },
99 "ssl_key_der": <DataProviderOptionInfo>{
100 "type": AbstractDataProviderType::get(BoolType),
101 "desc": "If `True` then the data represented by `ssl_key_location` will be assumed to be in binary "
102 "DER format",
103 "default_value": False,
104 },
105 "ssl_key_location": <DataProviderOptionInfo>{
106 "type": AbstractDataProviderType::get(StringType, NOTHING, {
107 DTT_FromFile: True,
108 DTT_FromLocation: True,
109 }),
110 "desc": "A path or location to a private key file for the X.509 client certificate",
111 },
112 "ssl_key_password": <DataProviderOptionInfo>{
113 "type": AbstractDataProviderType::get(StringType),
114 "desc": "The password to the private key given with `ssl_key_path` (text PEM format only)",
115 "sensitive": True,
116 },
117 "ssl_verify_cert": <DataProviderOptionInfo>{
118 "type": AbstractDataProviderType::get(BoolType),
119 "desc": "if `True` then the server's certificate will only be accepted if it's verified",
120 "default_value": False,
121 },
122 "timeout": <DataProviderOptionInfo>{
123 "type": AbstractDataProviderType::get(IntType),
124 "desc": "Transfer timeout to use in milliseconds (default: 45 seconds)",
125 "default_value": 45000,
126 },
127 "url": <DataProviderOptionInfo>{
128 "type": AbstractDataProviderType::get(StringType),
129 "desc": "A URL for an HTTP or HTTPS connection",
130 "required": True,
131 },
132 };
133
134 HTTPClient http;
135
136protected:
137 const ChildMap = {
138 "call": Class::forName("HttpClientDataProvider::HttpClientCallDataProvider"),
139 "delete": Class::forName("HttpClientDataProvider::HttpClientDeleteDataProvider"),
140 "get": Class::forName("HttpClientDataProvider::HttpClientGetDataProvider"),
141 "head": Class::forName("HttpClientDataProvider::HttpClientHeadDataProvider"),
142 "options": Class::forName("HttpClientDataProvider::HttpClientOptionsDataProvider"),
143 "patch": Class::forName("HttpClientDataProvider::HttpClientPatchDataProvider"),
144 "post": Class::forName("HttpClientDataProvider::HttpClientPostDataProvider"),
145 "put": Class::forName("HttpClientDataProvider::HttpClientPutDataProvider"),
146 };
147
148public:
149
151 constructor(*hash<auto> options);
152
153
155 constructor(HTTPClient http);
156
157
159 string getName();
160
161
163 *string getDesc();
164
165
167 *list<hash<DataProviderSummaryInfo>> getChildProviderSummaryInfo();
168
169
171 static HTTPClient getHttpConnection(hash<auto> options);
172
174 static hash<auto> makeRequest(HTTPClient http, string meth, *data body, string path, *hash<auto> hdr);
175
177
179protected:
181public:
182
183
185
189protected:
190 *AbstractDataProvider getChildProviderImpl(string name);
191public:
192
193
195protected:
196 hash<DataProviderInfo> getStaticInfoImpl();
197public:
198
199};
200};
*list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo()
Return data provider summary info.
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
*string getDesc()
Returns the data provider description.
constructor(*hash< auto > options)
Creates the object from constructor options.
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
string getName()
Returns the data provider name.
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
constructor(HTTPClient http)
Creates the object from an HTTP connection.
static HTTPClient getHttpConnection(hash< auto > options)
Returns an HTTP connection.
static hash< auto > makeRequest(HTTPClient http, string meth, *data body, string path, *hash< auto > hdr)
Makes an HTTP request and returns the response.
Qore HttpClientDataProvider module definition.
Definition: HttpClientCallDataProvider.qc.dox.h:26