/// <summary> /// Adds meta data for a file to an existing transaction by providing a /// file location and a transaction id. /// </summary> /// <param name="fileMeta">Meta data for the file</param> /// <param name="transactionId">A valid transaction Id of an existing /// transaction</param> /// <param name="fileId">An Id for the file. Should be the same /// as the fileId in the <see cref="AddOrReplaceFileToTansaction"/>.</param> /// <returns>A task</returns> /// <remarks>Make sure to call this method before /// <see cref="AddOrReplaceFileToTansaction"/>.</remarks> public Task AddOrReplaceFileMetaToTransaction(FileMeta fileMeta, string transactionId, string fileId) { if (fileMeta == null) { throw new ArgumentNullException("fileMeta"); } if (transactionId == null) { throw new ArgumentNullException(nameof(transactionId)); } if (string.IsNullOrWhiteSpace(transactionId)) { throw new ArgumentException("Cannot be empty or contain only whitespaces.", nameof(transactionId)); } if (fileId == null) { throw new ArgumentNullException(nameof(fileId)); } if (string.IsNullOrWhiteSpace(fileId)) { throw new ArgumentException("Cannot be empty or contain only whitespaces.", nameof(fileId)); } if (!ValidPathSegment(fileId)) { throw new ArgumentException("Contains invalid character.", nameof(fileId)); } return settings.Endpoint .AppendPathSegments("transaction", transactionId) .AppendPathSegments("file", fileId) .WithHeaders(new { Application = ApplicationHeader, Authorization = AuthorizationHeader }) .PutJsonAsync(fileMeta); }
/// <summary> /// Adds meta data for a file to an existing transaction by providing a /// file location and a transaction id. /// </summary> /// <param name="fileMeta">Meta data for the file</param> /// <param name="transactionId">A valid transaction Id of an existing /// transaction</param> /// <param name="fileId">An Id for the file. Should be the same /// as the fileId in the <see cref="AddOrReplaceFileToTansaction"/>.</param> /// <returns>A task</returns> /// <remarks>Make sure to call this method before /// <see cref="AddOrReplaceFileToTansaction"/>.</remarks> public Task AddOrReplaceFileMetaToTransaction(FileMeta fileMeta, string transactionId, string fileId) { return settings.Endpoint .AppendPathSegments("transaction", transactionId) .AppendPathSegments("file", fileId) .WithHeaders(new { Application = ApplicationHeader, Authorization = AuthorizationHeader }) .PutJsonAsync(fileMeta); }