MeshLib Documentation
Loading...
Searching...
No Matches
MR::WebRequest Class Reference

#include <MRWebRequest.h>

Classes

struct  FormData
 

Public Types

enum class  Method {
  Get , Post , Patch , Put ,
  Delete
}
 
using ResponseCallback = std::function<void( const Json::Value& response )>
 

Public Member Functions

 WebRequest ()=default
 
MRVIEWER_API WebRequest (std::string url)
 
MRVIEWER_API void clear ()
 
MRVIEWER_API void setMethod (Method method)
 
MRVIEWER_API void setTimeout (int timeoutMs)
 
MRVIEWER_API void setParameters (std::unordered_map< std::string, std::string > parameters)
 
MRVIEWER_API void setHeaders (std::unordered_map< std::string, std::string > headers)
 
MRVIEWER_API void setInputPath (std::string inputPath)
 
MRVIEWER_API void setUploadProgressCallback (ProgressCallback callback)
 
MRVIEWER_API void setFormData (std::vector< FormData > formData)
 
MRVIEWER_API void setBody (std::string body)
 
MRVIEWER_API void setOutputPath (std::string outputPath)
 
MRVIEWER_API void setDownloadProgressCallback (ProgressCallback callback)
 
MRVIEWER_API void setAsync (bool async)
 
MRVIEWER_API void setLogName (std::string logName)
 
MRVIEWER_API void send (std::string url, std::string logName, ResponseCallback callback, bool async=true)
 
MRVIEWER_API void send (ResponseCallback callback)
 

Member Typedef Documentation

◆ ResponseCallback

using MR::WebRequest::ResponseCallback = std::function<void( const Json::Value& response )>

Member Enumeration Documentation

◆ Method

enum class MR::WebRequest::Method
strong
Enumerator
Get 
Post 
Patch 
Put 
Delete 

Constructor & Destructor Documentation

◆ WebRequest() [1/2]

MR::WebRequest::WebRequest ( )
default

◆ WebRequest() [2/2]

MRVIEWER_API MR::WebRequest::WebRequest ( std::string url)
explicit

Member Function Documentation

◆ clear()

MRVIEWER_API void MR::WebRequest::clear ( )

◆ send() [1/2]

MRVIEWER_API void MR::WebRequest::send ( ResponseCallback callback)

◆ send() [2/2]

MRVIEWER_API void MR::WebRequest::send ( std::string url,
std::string logName,
ResponseCallback callback,
bool async = true )

send request, calling callback on answer, if async then callback is called in next frame after getting response NOTE: downloading a binary file in synchronous mode is forbidden by JavaScript

Parameters
logNamename for logging

◆ setAsync()

MRVIEWER_API void MR::WebRequest::setAsync ( bool async)

◆ setBody()

MRVIEWER_API void MR::WebRequest::setBody ( std::string body)

◆ setDownloadProgressCallback()

MRVIEWER_API void MR::WebRequest::setDownloadProgressCallback ( ProgressCallback callback)

◆ setFormData()

MRVIEWER_API void MR::WebRequest::setFormData ( std::vector< FormData > formData)

◆ setHeaders()

MRVIEWER_API void MR::WebRequest::setHeaders ( std::unordered_map< std::string, std::string > headers)

◆ setInputPath()

MRVIEWER_API void MR::WebRequest::setInputPath ( std::string inputPath)

◆ setLogName()

MRVIEWER_API void MR::WebRequest::setLogName ( std::string logName)

◆ setMethod()

MRVIEWER_API void MR::WebRequest::setMethod ( Method method)

◆ setOutputPath()

MRVIEWER_API void MR::WebRequest::setOutputPath ( std::string outputPath)

◆ setParameters()

MRVIEWER_API void MR::WebRequest::setParameters ( std::unordered_map< std::string, std::string > parameters)

◆ setTimeout()

MRVIEWER_API void MR::WebRequest::setTimeout ( int timeoutMs)

◆ setUploadProgressCallback()

MRVIEWER_API void MR::WebRequest::setUploadProgressCallback ( ProgressCallback callback)

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