Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cWebAPIClient Class Reference

#include <cWebAPIClient.h>

Inheritance diagram for GrayLib::cWebAPIClient:
GrayLib::cHttpCopier GrayLib::cHttpClient Gray::IFileCopier GrayLib::cHttpCommon

Public Member Functions

 cWebAPIClient (const char *pszURL=nullptr, const char *pszAgentName=GRAY_NAMES)
 
 ~cWebAPIClient ()
 
cVariant GetVar (const char *pszObject=nullptr)
 
 UNITTEST_FRIEND (cWebAPIClient)
 
- Public Member Functions inherited from GrayLib::cHttpCopier
 cHttpCopier (const char *pszServerURL=nullptr, const char *pszAgentName=GRAY_NAMES)
 
virtual ~cHttpCopier ()
 
virtual HRESULT Connect (const FILECHAR_t *pszServerURL) override
 
void Close ()
 
bool isConnected () const
 
- Public Member Functions inherited from GrayLib::cHttpClient
 cHttpClient (cStream *pStream=nullptr, const char *pszServerURL=nullptr, const char *pszAgentName=GRAY_NAMES)
 
virtual ~cHttpClient ()
 
void AttachStream (cStream *pStream)
 
cStreamget_Stream () const
 
HRESULT Send_GET (HTTPVERB_TYPE eVerb, cStringA sObject)
 
HRESULT Send_POST (const char *pszReferer, const char *pszArgs, StrLen_t nLenArgs)
 
HRESULT Send_POST (const char *pszReferer, const cIniSectionData &args)
 
HRESULT Send_POST (cHttpPart **ppParts, int iParts, IStreamProgressCallback *pProgress=nullptr)
 
virtual cStringA get_ConnectName () const override
 get a debug name for the connection. More...
 
virtual HRESULT RequestFile (const FILECHAR_t *pszSrcName, const FILECHAR_t *pszDestPath, IStreamProgressCallback *pProgress, FILE_SIZE_t nOffsetStart, FILE_SIZE_t *pnRequestSizeEst) override
 
virtual HRESULT SendFile (const FILECHAR_t *pszSrcPath, const FILECHAR_t *pszDestName, IStreamProgressCallback *pProgress, FILE_SIZE_t nOffsetStart, FILE_SIZE_t nSize) override
 
HRESULT WaitForHeader (OUT cHttpHeaderServer &Head, IStreamProgressCallback *pProgress, TIMESYSD_t timeout=cTimeSys::k_DMAX)
 
HRESULT ReadBodyChunk (cHttpClientBody &body)
 
HRESULT WaitForBody (const cHttpHeader &Head, cStreamOutput *psBody, IStreamProgressCallback *pProgress, OUT FILE_SIZE_t *pnRequestSizeEst)
 
HRESULT WaitForResponse (OUT cHttpHeaderServer &Head, cStreamOutput *psBody, IStreamProgressCallback *pProgress, FILE_SIZE_t *pnRequestSizeEst)
 
 UNITTEST_FRIEND (cHttpClient)
 
- Public Member Functions inherited from Gray::IFileCopier
virtual ~ IFileCopier ()
 
virtual HRESULT SendAttr (const FILECHAR_t *pszDestName, cTimeFile timeChanged)
 
- Public Member Functions inherited from GrayLib::cHttpCommon
 UNITTEST_FRIEND (cHttpCommon)
 

Protected Attributes

cNetStream m_Stream
 a cNetSocket i can Seek() on. More...
 
- Protected Attributes inherited from GrayLib::cHttpClient
cStreamm_pStream
 the data stream to/from the HTTP server. may be cNetSocket -> cNetStream (or SSL or other) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cHttpClient
static StrLen_t GRAYCALL Encode_POST (char *pszArgs, StrLen_t nLenMax, const cIniSectionData &args)
 
- Static Public Member Functions inherited from GrayLib::cHttpCommon
static HTTPVERB_TYPE GRAYCALL FindVerb (const char *pszVerb)
 
static HTTPRET_TYPE GRAYCALL GetErrorHttpRet (HRESULT hRes)
 
static HRESULT GRAYCALL GetErrorHResult (HTTPRET_TYPE eRetCode)
 
static cStringA GRAYCALL GetErrorText (HTTPRET_TYPE eRetCode)
 
- Public Attributes inherited from GrayLib::cHttpCopier
cNetStream m_Stream
 cNetStream = a cNetSocket i can Seek() on. More...
 
- Public Attributes inherited from GrayLib::cHttpClient
const char *const m_pszAgentName
 Who are we. Who is asking? e.g. I am a browser. More...
 
cNetURL m_url
 The name of the host we are talking to. cNetAddrName -> cNetAddress. More...
 
- Static Public Attributes inherited from GrayLib::cHttpCommon
static const size_t k_CR_SIZE = 2
 sizeof HTTP_CR "\r\n" More...
 
static const char * k_Space = "&nbsp;"
 "&nbsp;" More...
 
static const char *const k_szVerbs [HTTPVERB_QTY+1]
 
static const cPairT< HTTPRET_TYPE, HRESULTk_HttpReturnErrors []
 

Detailed Description

Client side of the connection. similar to CURL. use a HTTP like RESTful API to get data from a server. NOT the same as WebService, NOT SOAP.

Constructor & Destructor Documentation

◆ cWebAPIClient()

GrayLib::cWebAPIClient::cWebAPIClient ( const char *  pszURL = nullptr,
const char *  pszAgentName = GRAY_NAMES 
)

◆ ~cWebAPIClient()

GrayLib::cWebAPIClient::~cWebAPIClient ( )

Member Function Documentation

◆ GetVar()

cVariant GrayLib::cWebAPIClient::GetVar ( const char *  pszObject = nullptr)

Synchronous/Blocking request from a server for data. Pull a JSON or XML blob from the server. Assume we have a security token as cookie for this session.

Returns
the variant return from the WebAPI call parsed into a variant map object. Usually via JSON or XML.

◆ UNITTEST_FRIEND()

GrayLib::cWebAPIClient::UNITTEST_FRIEND ( cWebAPIClient  )

Member Data Documentation

◆ m_Stream

cNetStream GrayLib::cWebAPIClient::m_Stream
protected

a cNetSocket i can Seek() on.


The documentation for this class was generated from the following files: