|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Definition of an outbound HTTP call template from the REST API XML. More...
#include <RESTAPI.h>
Public Member Functions | |
| RESTHTTPCall () | |
| Create an empty call definition; populate with init(). | |
| ~RESTHTTPCall () | |
| Destructor. | |
| bool | init (XMLNode objectNode) |
| Populate this call definition from its XML node in the API definition. | |
| HTTPRequest * | generateHTTPRequest (RESTRequest *restReq) |
| Build the outbound HTTP request for a parsed REST request, substituting parameters into URL, headers and body. | |
Public Attributes | |
| std::string | name |
| Call name from the API definition. | |
| std::string | url |
| URL template (with parameter placeholders). | |
| uint8 | ops |
| Allowed HTTP operations bitmask (GET/POST/...). | |
| std::string | contentType |
| Content-Type for the request body. | |
| std::string | cacheControl |
| Cache-Control header value, if any. | |
| std::map< std::string, std::string > | headerEntries |
| Fixed header key/values. | |
| std::map< std::string, std::string > | headerParams |
| Headers filled from request parameters. | |
| std::map< std::string, std::string > | bodyEntries |
| Fixed body key/values. | |
| std::map< std::string, std::string > | bodyParams |
| Body fields filled from request parameters. | |
| std::map< std::string, std::string > | bodyContentTypes |
| Per-body-part content types (e.g. | |
Definition of an outbound HTTP call template from the REST API XML.
Describes how to turn a validated RESTRequest into an HTTPRequest: URL and header/body templates with parameter substitution. Instances are created and owned by RESTParser during init().
| cmlabs::RESTHTTPCall::RESTHTTPCall | ( | ) |
Create an empty call definition; populate with init().
Definition at line 1599 of file RESTAPI.cpp.
| cmlabs::RESTHTTPCall::~RESTHTTPCall | ( | ) |
Destructor.
Definition at line 1602 of file RESTAPI.cpp.
| HTTPRequest * cmlabs::RESTHTTPCall::generateHTTPRequest | ( | RESTRequest * | restReq | ) |
Build the outbound HTTP request for a parsed REST request, substituting parameters into URL, headers and body.
| restReq | The validated request supplying parameter values. |
Definition at line 1684 of file RESTAPI.cpp.
References bodyContentTypes, bodyEntries, bodyParams, cmlabs::HTTPPostEntry::content, cmlabs::HTTPPostEntry::contentSize, cmlabs::HTTPRequest::createMultipartRequest(), cmlabs::RESTRequest::getDataCopy(), cmlabs::html::GetHostFromURL(), cmlabs::RESTRequest::getString(), cmlabs::html::GetURIFromURL(), headerEntries, headerParams, cmlabs::html::IsMimeBinary(), cmlabs::HTTPPostEntry::name, ops, cmlabs::HTTPPostEntry::type, and url.
| bool cmlabs::RESTHTTPCall::init | ( | XMLNode | objectNode | ) |
Populate this call definition from its XML node in the API definition.
| objectNode | XML node describing the HTTP call. |
Definition at line 1605 of file RESTAPI.cpp.
References bodyContentTypes, bodyEntries, bodyParams, cacheControl, contentType, cmlabs::XMLNode::getAttribute(), cmlabs::XMLNode::getChildNode(), headerEntries, headerParams, HTTP_DELETE, HTTP_GET, HTTP_POST, HTTP_PUT, name, cmlabs::XMLNode::nChildNode(), ops, stricmp, and url.
Referenced by cmlabs::RESTParser::init().
| std::map<std::string, std::string> cmlabs::RESTHTTPCall::bodyContentTypes |
Per-body-part content types (e.g.
multipart).
Definition at line 240 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::map<std::string, std::string> cmlabs::RESTHTTPCall::bodyEntries |
Fixed body key/values.
Definition at line 238 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::map<std::string, std::string> cmlabs::RESTHTTPCall::bodyParams |
Body fields filled from request parameters.
Definition at line 239 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::string cmlabs::RESTHTTPCall::cacheControl |
| std::string cmlabs::RESTHTTPCall::contentType |
| std::map<std::string, std::string> cmlabs::RESTHTTPCall::headerEntries |
Fixed header key/values.
Definition at line 236 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::map<std::string, std::string> cmlabs::RESTHTTPCall::headerParams |
Headers filled from request parameters.
Definition at line 237 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::string cmlabs::RESTHTTPCall::name |
| uint8 cmlabs::RESTHTTPCall::ops |
Allowed HTTP operations bitmask (GET/POST/...).
Definition at line 232 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().
| std::string cmlabs::RESTHTTPCall::url |
URL template (with parameter placeholders).
Definition at line 231 of file RESTAPI.h.
Referenced by generateHTTPRequest(), and init().