Classes | |
class | ClientConfig |
High level interface to Gazebo Fuel. More... | |
class | CollectionIdentifier |
Defines how to identify a collection. More... | |
class | FuelClient |
High level interface to Gazebo Fuel. More... | |
class | JSONParser |
A helper class for making REST requests. More... | |
class | Model |
Defines how to identify a model. More... | |
class | ModelIdentifier |
Defines how to identify a model. More... | |
class | ModelIter |
class for iterating through models More... | |
class | Rest |
A helper class for making REST requests. More... | |
struct | RestResponse |
Stores a response to a RESTful request. More... | |
class | Result |
Class describing a result of an operation. More... | |
class | ServerConfig |
Describes options needed for a server. More... | |
class | WorldIdentifier |
Defines how to identify a world. More... | |
class | WorldIter |
class for iterating through worlds More... | |
class | Zip |
A helper class for making REST requests. More... | |
Enumerations | |
enum class | HttpMethod { GET , POST , DELETE , PUT , PATCH , POST_FORM , PATCH_FORM } |
the types of HTTP methods More... | |
enum class | ResultType { UNKNOWN = 0 , DELETE , DELETE_NOT_FOUND , DELETE_ERROR , FETCH , FETCH_ALREADY_EXISTS , FETCH_NOT_FOUND , FETCH_ERROR , UPLOAD , UPLOAD_ALREADY_EXISTS , UPLOAD_ERROR , PATCH_ERROR , PATCH } |
Result type. More... | |
Functions | |
std::string | fetchResource (const std::string &_uri) |
Download the specified resource into the default configuration of fuel tools. This will place the asset in ~/.gz/fuel. More... | |
std::string | fetchResourceWithClient (const std::string &_uri, FuelClient &_client) |
Download the specified resource using the ClientConfig contained in the FuelClient parameter. More... | |
std::string | sanitizeAuthority (const std::string &_uriAuthority) |
Convert the authority portion of a URI to a string suitable to be used as a path on disk for all platforms. More... | |
std::string | sdfFromPath (const std::string &_path) |
Get the SDF file path for a model or world based on a directory containing a Fuel model or world. Here is a typical use case: More... | |
std::string | uriToPath (const gz::common::URI &_uri) |
Convert a URI to a string suitable to use as a path on disk. It strips the scheme and authority's // prefix. More... | |
Enumeration Type Documentation
◆ HttpMethod
|
strong |
◆ ResultType
|
strong |
Result type.
Enumerator | |
---|---|
UNKNOWN | Uninitialized type. |
DELETE | Delete successful. |
DELETE_NOT_FOUND | Model not found. |
DELETE_ERROR | Delete failed. Other errors.
|
FETCH | Fetch successful. |
FETCH_ALREADY_EXISTS | Model already exists. |
FETCH_NOT_FOUND | Model not found. |
FETCH_ERROR | Fetch failed. Other errors.
|
UPLOAD | Upload successful. |
UPLOAD_ALREADY_EXISTS | Model already exists. |
UPLOAD_ERROR | Upload failed. Other errors.
|
PATCH_ERROR | Patch failed. |
PATCH | Patch successful. |
Function Documentation
◆ fetchResource()
std::string gz::fuel_tools::fetchResource | ( | const std::string & | _uri | ) |
Download the specified resource into the default configuration of fuel tools. This will place the asset in ~/.gz/fuel.
- Parameters
-
[in] _uri URI to the asset.
- Returns
- Path to the downloaded asset. Empty on error.
◆ fetchResourceWithClient()
std::string gz::fuel_tools::fetchResourceWithClient | ( | const std::string & | _uri, |
FuelClient & | _client | ||
) |
Download the specified resource using the ClientConfig contained in the FuelClient parameter.
- Parameters
-
[in] _uri URI to the asset. [in] _client Custom FuelClient configuration.
- Returns
- Path to the downloaded asset. Empty on error.
◆ sanitizeAuthority()
std::string gz::fuel_tools::sanitizeAuthority | ( | const std::string & | _uriAuthority | ) |
Convert the authority portion of a URI to a string suitable to be used as a path on disk for all platforms.
It encodes illegal characters on Windows and Linux filesystems with their corresponding URL-encoded values.
This assumes an authority of the form: username@host:port "@" is encoded as %40 ":" is encoded as %3A
- Parameters
-
[in] _uriAuthority the authority section of the URI to convert.
- Returns
- String suitable to use in file paths
◆ sdfFromPath()
std::string gz::fuel_tools::sdfFromPath | ( | const std::string & | _path | ) |
Get the SDF file path for a model or world based on a directory containing a Fuel model or world. Here is a typical use case:
- Fetch a Fuel resource:
std::string resourcePath = fetchResource("https://...")
- Get the SDF file for the resource:
std::string resourceSdf = sdfFromPath(resourcePath)
- Parse the SDF file using libsdformat.
This function will determine the SDF file according to the following:
- Check for a metadata.pbtxt file, and return the SDF file specified within the metadata.pbtxt file.
- Check for a model.config file, and return the SDF file specified withing the model.config file.
- Return the first file with an
.sdf
extension.- Parameters
-
[in] _path Filesystem path to a Fuel model or world directory.
- Returns
- Full path to the model or world SDF file, or empty string if the SDF file coult not be determined.
◆ uriToPath()
std::string gz::fuel_tools::uriToPath | ( | const gz::common::URI & | _uri | ) |
Convert a URI to a string suitable to use as a path on disk. It strips the scheme and authority's //
prefix.
- Parameters
-
[in] _uri URI to convert.
- Returns
- String suitable to use in file paths