private IEnumerator PutBlobBytes(Action <RestResponse> callback, byte[] bytes, string resourcePath, string filename, string contentType) { int contentLength = bytes.Length; // TODO: check size is ok? Dictionary <string, string> headers = new Dictionary <string, string>(); string file = Path.GetFileName(filename); headers.Add("Content-Type", contentType); headers.Add("x-ms-blob-content-disposition", string.Format("attachment; filename=\"{0}\"", file)); headers.Add("x-ms-blob-type", "BlockBlob"); string filePath = resourcePath.Length > 0 ? resourcePath + "/" + file : file; StorageRequest request = Auth.CreateAuthorizedStorageRequest(client, Method.PUT, filePath, null, headers, contentLength); // add body request.AddBody(bytes, contentType); yield return(request.Request.Send()); #if UNITY_EDITOR while (request.Request.responseCode == -1L) { } #endif request.Result(callback); }
public IEnumerator DeleteBlob(Action <RestResponse> callback, string resourcePath, string filename) { string filePath = resourcePath.Length > 0 ? resourcePath + "/" + filename : filename; StorageRequest request = Auth.CreateAuthorizedStorageRequest(client, Method.DELETE, filePath); yield return(request.Send()); request.Result(callback); }
public IEnumerator GetTextBlob(Action <RestResponse> callback, string resourcePath = "") { // public request string url = UrlHelper.BuildQuery(client.SecondaryEndpoint(), "", resourcePath); StorageRequest request = new StorageRequest(url, Method.GET); yield return(request.Request.Send()); request.Result(callback); }