Upload Data
Upload Data Function (Task)
Task<> IPFS.IpfsFunctionLibrary.UploadData(
IpfsPinningServiceConfig ipfsPinningServiceConfig,
string bearerToken,
string dataToUpload,
string saveAs)
This function uploads data to the IPFS network. This function requires inputs as follows:
ipfsPinningServiceConfig
: Holds the URL and name of the pinning service to send the request to.bearerToken
: The API token for authentication.dataToUpload
: The path of the file to upload.saveAs
: Optional alternate filename for the uploaded file on IPFS.
The returned Response is a Task
that holds data such as headers, status code, and body of the response of the HTTP
request.
Task<(bool success, string errorMessage, HttpResponse response, string cid)>
info
If success
is true
that only means the upload to the IPFS network was successful.
If successful, returns the cid
of the uploaded data in string format.
Upload Data Function (Delegate)
void IPFS.IpfsFunctionLibrary.UploadData(
IpfsPinningServiceConfig ipfsPinningServiceConfig,
string bearerToken,
string dataToUpload,
string saveAs,
IpfsUploadDataDelegate responseDelegate)
This is a wrapper function for the async implementation. It exists to provide the same functionality but using a delegate for handling responses.
delegate void IpfsUploadDataDelegate(
bool success,
string errorMessage,
HttpResponse response,
string cid)