cpp-ipfs-http-client
IPFS C++ client library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ipfs::http::Transport Class Referenceabstract

Convenience interface for talking basic HTTP. More...

#include <ipfs/http/transport.h>

Inheritance diagram for ipfs::http::Transport:
ipfs::http::TransportCurl

Public Member Functions

virtual std::unique_ptr< TransportClone () const =0
 Return a deep copy of this object.
 
virtual ~Transport ()
 Destructor.
 
virtual void Fetch (const std::string &url, const std::vector< FileUpload > &files, std::iostream *response)=0
 Fetch the contents of a given URL.
 
virtual void StopFetch ()=0
 Stop the Fetch method abruptly.
 
virtual void ResetFetch ()=0
 Reset the internal state, after StopFetch() is called.
 
virtual void UrlEncode (const std::string &raw, std::string *encoded)=0
 URL encode a string.
 

Detailed Description

Convenience interface for talking basic HTTP.

Member Function Documentation

◆ Clone()

virtual std::unique_ptr< Transport > ipfs::http::Transport::Clone ( ) const
pure virtual

Return a deep copy of this object.

Returns
unique pointer of Transport object

Implemented in ipfs::http::TransportCurl.

◆ Fetch()

virtual void ipfs::http::Transport::Fetch ( const std::string &  url,
const std::vector< FileUpload > &  files,
std::iostream *  response 
)
pure virtual

Fetch the contents of a given URL.

If any files are provided in files, they are submitted using "Content-Type: multipart/form-data".

Fetch method is thread-safe. Therefor, can be used within a thread.

Exceptions
std::exceptionif any error occurs including erroneous HTTP status code
Parameters
[in]urlURL to get.
[in]filesList of files to upload.
[out]responseOutput to save the response body to.

Implemented in ipfs::http::TransportCurl.

◆ ResetFetch()

virtual void ipfs::http::Transport::ResetFetch ( )
pure virtual

Reset the internal state, after StopFetch() is called.

This method needs to be called once the thread is fully finished. Ideally after client.abort() and thread.join() methods.

Call this method out-side of the running thread, eg. the main thread.

Implemented in ipfs::http::TransportCurl.

◆ StopFetch()

virtual void ipfs::http::Transport::StopFetch ( )
pure virtual

Stop the Fetch method abruptly.

When the Fetch method is used within a thead, but you want to stop the thread (without using pthread_cancel).

Call this method out-side of the running thread, eg. the main thread.

Implemented in ipfs::http::TransportCurl.

◆ UrlEncode()

virtual void ipfs::http::Transport::UrlEncode ( const std::string &  raw,
std::string *  encoded 
)
pure virtual

URL encode a string.

URLEcode method is thread-safe.

Parameters
[in]rawInput string to encode.
[out]encodedURL encoded result.

Implemented in ipfs::http::TransportCurl.


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