Gazebo Fuel_tools

API Reference

7.3.1

A helper class for making REST requests. More...

#include <RestClient.hh>

Public Member Functions

 Rest ()=default
 Default constructor. More...
 
virtual RestResponse Request (const HttpMethod _method, const std::string &_url, const std::string &_version, const std::string &_path, const std::vector< std::string > &_queryStrings, const std::vector< std::string > &_headers, const std::string &_data, const std::multimap< std::string, std::string > &_form=std::multimap< std::string, std::string >()) const
 Trigger a REST request. More...
 
void SetUserAgent (const std::string &_agent)
 Set the user agent name. More...
 
const std::stringUserAgent () const
 Get the user agent name. More...
 

Detailed Description

A helper class for making REST requests.

Constructor & Destructor Documentation

◆ Rest()

Rest ( )
default

Default constructor.

Member Function Documentation

◆ Request()

virtual RestResponse Request ( const HttpMethod  _method,
const std::string _url,
const std::string _version,
const std::string _path,
const std::vector< std::string > &  _queryStrings,
const std::vector< std::string > &  _headers,
const std::string _data,
const std::multimap< std::string, std::string > &  _form = std::multimapstd::stringstd::string >() 
) const
virtual

Trigger a REST request.

Parameters
[in]_methodThe HTTP method. Use all uppercase letters. E.g.: "GET"
[in]_urlThe url to request. E.g.: "http://localhost:8000/"
[in]_versionThe protocol version. E.g.: "1.0"
[in]_pathThe path to request. E.g.: "collection"
[in]_queryStringsAll the query strings to be requested. E.g.: {"sort=name", "sortdir=1"}
[in]_headersAll the headers to be included in the HTTP request E.g.: {"Accept: application/json"}
[in]_dataData to be included in the HTTP request.
[in]_formMulti-part / form data to be used with Method::POST_FORM. Files can be transferred by using a value of "@<local_file_path>;<upload_filename>". For example, to transfer the local file "/tmp/test.txt" and upload the file as "changed.txt" in a form with the field name "file", then insert the following key-value pair into the _form parameter: {"file", "@/tmp/test.txt;changed.txt"}. The ";<upload_filename>" portion is optional. If this part is absent, then the basename of provided "<local_file_path>" is used. For example, "@/tmp/text.txt" will be uploaded as "text.txt".

◆ SetUserAgent()

void SetUserAgent ( const std::string _agent)

Set the user agent name.

Parameters
[in]_agentUser agent name.

◆ UserAgent()

const std::string& UserAgent ( ) const

Get the user agent name.

Returns
Name of the user agent.

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