MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::WebRequest Class Reference

this class is needed to unify cpp and wasm requests More...

#include <MRWebRequest.h>

Classes

struct  FormData
 set payload in multipart/form-data format More...
 

Public Types

enum class  Method {
  Method::Get , Method::Post , Method::Patch , Method::Put ,
  Method::Delete
}
 
using ResponseCallback = MR::WebResponseCallback
 

Public Member Functions

 WebRequest ()=default
 
MRVIEWER_API WebRequest (std::string url)
 
MRVIEWER_API void clear ()
 clear all request data
 
MRVIEWER_API void setMethod (Method method)
 set HTTP method
 
MRVIEWER_API void setTimeout (int timeoutMs)
 set timeout in milliseconds
 
MRVIEWER_API void setParameters (std::unordered_map< std::string, std::string > parameters)
 set URL query parameters
 
MRVIEWER_API void setHeaders (std::unordered_map< std::string, std::string > headers)
 set HTTP headers
 
MRVIEWER_API void setInputPath (std::filesystem::path inputPath)
 set path to the file to upload
 
MRVIEWER_API void setUploadProgressCallback (ProgressCallback callback)
 
MRVIEWER_API void setFormData (std::vector< FormData > formData)
 
MRVIEWER_API void setBody (std::string body)
 set payload in plain format
 
MRVIEWER_API void setOutputPath (std::filesystem::path outputPath)
 prefer to save the response to file
 
MRVIEWER_API void setDownloadProgressCallback (ProgressCallback callback)
 set progress callback for download
 
MRVIEWER_API void setAsync (bool async)
 set async mode (return immediately after sending request)
 
MRVIEWER_API void setLogName (std::string logName)
 set log name
 
MRVIEWER_API void send (std::string url, std::string logName, ResponseCallback callback, bool async=true)
 
MRVIEWER_API void send (ResponseCallback callback)
 

Static Public Member Functions

static MRVIEWER_API void waitRemainingAsync ()
 if any async request is still in progress, wait for it
 

Detailed Description

this class is needed to unify cpp and wasm requests


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