CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::RESTHTTPCall Class Reference

Definition of an outbound HTTP call template from the REST API XML. More...

#include <RESTAPI.h>

Collaboration diagram for cmlabs::RESTHTTPCall:
[legend]

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.
HTTPRequestgenerateHTTPRequest (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.

Detailed Description

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().

Definition at line 211 of file RESTAPI.h.

Constructor & Destructor Documentation

◆ RESTHTTPCall()

cmlabs::RESTHTTPCall::RESTHTTPCall ( )

Create an empty call definition; populate with init().

Definition at line 1599 of file RESTAPI.cpp.

◆ ~RESTHTTPCall()

cmlabs::RESTHTTPCall::~RESTHTTPCall ( )

Destructor.

Definition at line 1602 of file RESTAPI.cpp.

Member Function Documentation

◆ generateHTTPRequest()

HTTPRequest * cmlabs::RESTHTTPCall::generateHTTPRequest ( RESTRequest * restReq)

Build the outbound HTTP request for a parsed REST request, substituting parameters into URL, headers and body.

Parameters
restReqThe validated request supplying parameter values.
Returns
New HTTPRequest (caller takes ownership), or NULL on failure.

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.

◆ init()

bool cmlabs::RESTHTTPCall::init ( XMLNode objectNode)

Populate this call definition from its XML node in the API definition.

Parameters
objectNodeXML node describing the HTTP call.
Returns
true if the definition is valid.

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().

Member Data Documentation

◆ bodyContentTypes

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().

◆ bodyEntries

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().

◆ bodyParams

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().

◆ cacheControl

std::string cmlabs::RESTHTTPCall::cacheControl

Cache-Control header value, if any.

Definition at line 234 of file RESTAPI.h.

Referenced by init().

◆ contentType

std::string cmlabs::RESTHTTPCall::contentType

Content-Type for the request body.

Definition at line 233 of file RESTAPI.h.

Referenced by init().

◆ headerEntries

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().

◆ headerParams

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().

◆ name

std::string cmlabs::RESTHTTPCall::name

Call name from the API definition.

Definition at line 230 of file RESTAPI.h.

Referenced by init().

◆ ops

uint8 cmlabs::RESTHTTPCall::ops

Allowed HTTP operations bitmask (GET/POST/...).

Definition at line 232 of file RESTAPI.h.

Referenced by generateHTTPRequest(), and init().

◆ url

std::string cmlabs::RESTHTTPCall::url

URL template (with parameter placeholders).

Definition at line 231 of file RESTAPI.h.

Referenced by generateHTTPRequest(), and init().


The documentation for this class was generated from the following files:
  • /home/ubuntu/c/partner/psyclone2/CMSDK/include/RESTAPI.h
  • /home/ubuntu/c/partner/psyclone2/CMSDK/src/RESTAPI.cpp