public static HttpRequestMessage Finish(B2Options options, string fileId, string[] partSHA1Array) { var content = JsonConvert.SerializeObject(new { fileId, partSha1Array = partSHA1Array }); var request = BaseRequestGenerator.PostRequestJson(Endpoints.Finish, content, options); return(request); }
public static HttpRequestMessage Cancel(B2Options options, string fileId) { var content = JsonConvert.SerializeObject(new { fileId }); var request = BaseRequestGenerator.PostRequestJson(Endpoints.Cancel, content, options); return(request); }
public static HttpRequestMessage ListParts(B2Options options, string fileId, int startPartNumber, int maxPartCount) { if (startPartNumber < 1 || startPartNumber > 10000) { throw new Exception("Start part number must be between 1 and 10,000"); } var content = JsonConvert.SerializeObject(new { fileId, startPartNumber, maxPartCount }); var request = BaseRequestGenerator.PostRequestJson(Endpoints.ListParts, content, options); return(request); }
public static HttpRequestMessage IncompleteFiles(B2Options options, string bucketId, string startFileId = "", string maxFileCount = "") { var body = "{\"bucketId\":\"" + bucketId + "\""; if (!string.IsNullOrEmpty(startFileId)) { body += ", \"startFileId\":" + JsonConvert.ToString(startFileId); } if (!string.IsNullOrEmpty(maxFileCount)) { body += ", \"maxFileCount\":" + JsonConvert.ToString(maxFileCount); } body += "}"; var request = BaseRequestGenerator.PostRequestJson(Endpoints.IncompleteFiles, body, options); return(request); }
public static HttpRequestMessage GetUploadPartUrl(B2Options options, string fileId) { return(BaseRequestGenerator.PostRequest(Endpoints.GetPartUrl, "{\"fileId\":\"" + fileId + "\"}", options)); }
public static HttpRequestMessage GetUploadPartUrl(B2Options options, string fileId) { return(BaseRequestGenerator.PostRequest(Endpoints.GetPartUrl, JsonConvert.SerializeObject(new { fileId }), options)); }