3#if defined( __EMSCRIPTEN__ ) || !defined( MRMESH_NO_CPR )
6#include <unordered_map>
45 MRVIEWER_API
void setParameters( std::unordered_map<std::string, std::string> parameters );
48 MRVIEWER_API
void setHeaders( std::unordered_map<std::string, std::string> headers );
65 MRVIEWER_API
void setFormData( std::vector<FormData> formData );
68 MRVIEWER_API
void setBody( std::string body );
88 MRVIEWER_API
void send( std::string url, std::string logName,
ResponseCallback callback,
bool async =
true );
99 int timeout_{ 10000 };
100 std::unordered_map<std::string, std::string> params_;
101 std::unordered_map<std::string, std::string> headers_;
102 std::filesystem::path inputPath_;
103 std::vector<FormData> formData_;
105 std::filesystem::path outputPath_;
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
std::string path
Definition MRWebRequest.h:60
void setAsync(bool async)
set async mode (return immediately after sending request)
void setFormData(std::vector< FormData > formData)
void setLogName(std::string logName)
set log name
MR::WebResponseCallback ResponseCallback
Definition MRWebRequest.h:82
void send(std::string url, std::string logName, ResponseCallback callback, bool async=true)
void setTimeout(int timeoutMs)
set timeout in milliseconds
void setDownloadProgressCallback(ProgressCallback callback)
set progress callback for download
void setHeaders(std::unordered_map< std::string, std::string > headers)
set HTTP headers
tl::expected< T, E > Expected
Definition MRExpected.h:31
std::string name
Definition MRWebRequest.h:62
void send(ResponseCallback callback)
WebRequest(std::string url)
Expected< Json::Value > parseResponse(const Json::Value &response)
returns json value of text or error if response failed
void setUploadProgressCallback(ProgressCallback callback)
void setOutputPath(std::filesystem::path outputPath)
prefer to save the response to file
std::string fileName
Definition MRWebRequest.h:63
void clear()
clear all request data
std::function< void(const Json::Value &response)> WebResponseCallback
Definition MRWebResponseCallback.h:12
static void waitRemainingAsync()
if any async request is still in progress, wait for it
void setInputPath(std::filesystem::path inputPath)
set path to the file to upload
void setBody(std::string body)
set payload in plain format
Method
Definition MRWebRequest.h:27
void setMethod(Method method)
set HTTP method
void setParameters(std::unordered_map< std::string, std::string > parameters)
set URL query parameters
std::string contentType
Definition MRWebRequest.h:61
@ Post
Definition MRWebRequest.h:29
@ Patch
Definition MRWebRequest.h:30
@ Get
Definition MRWebRequest.h:28
@ Put
Definition MRWebRequest.h:31
@ Delete
Definition MRWebRequest.h:32
only for bindings generation
Definition MRCameraOrientationPlugin.h:8