/// <summary> /// Send and recieve string message. /// </summary> /// <param name="requestUri">The request uri to upload to.</param> /// <param name="message">The received message</param> /// <returns>The response message</returns> public string MessageString(string requestUri, string message) { try { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; return(http.UploadString(requestUri, message)); } catch (Exception) { throw; } }
/// <summary> /// Send and recieve byte message. /// </summary> /// <param name="requestUri">The request uri to upload to.</param> /// <param name="message">The received message</param> /// <returns>The response message</returns> public byte[] MessageByte(string requestUri, byte[] message) { try { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; return(Encoding.Default.GetBytes(http.UploadString(requestUri, Encoding.Default.GetString(message)))); } catch (Exception) { throw; } }
/// <summary> /// Downloads a request uri to a local file. /// </summary> /// <param name="requestUri">The request uri to download.</param> /// <param name="destinationFile">The local destination file to copy the data to.</param> public void DownloadFile(string requestUri, string destinationFile) { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; http.DownloadFile(requestUri, destinationFile); }
/// <summary> /// Uploads data to the request uri. /// </summary> /// <param name="requestUri">The request uri to upload to.</param> /// <param name="data">The data to upload.</param> /// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http.</param> /// <returns>A System.String containing the response sent by the server.</returns> public string UploadString(string requestUri, string data, string method) { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; return(http.UploadString(requestUri, data, method)); }
/// <summary> /// Upload a local file to the request uri. /// </summary> /// <param name="requestUri">The request uri to upload to.</param> /// <param name="sourceFile">The local source file to upload data from.</param> /// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http.</param> /// <returns>A System.Byte array containing the body of the response from the resource.</returns> public byte[] UploadFile(string requestUri, string sourceFile, string method) { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; return(http.UploadFile(requestUri, sourceFile, method)); }
/// <summary> /// Downloads data from the request uri. /// </summary> /// <param name="requestUri">The request uri to download.</param> /// <returns>The returned request uri content.</returns> public string DownloadString(string requestUri) { Nequeo.Net.Http.HttpClient http = new Http.HttpClient(); http.Connection = _connection; return(http.DownloadString(requestUri)); }