Skip to content

Commit

Permalink
Add helper service methods for individual parts of the upload process
Browse files Browse the repository at this point in the history
  • Loading branch information
tism committed Oct 11, 2012
1 parent 450b93f commit b83e2e4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
44 changes: 40 additions & 4 deletions IntegrityIntegration/Integrity.cs
Expand Up @@ -115,11 +115,17 @@ public IList<String> AvailableDatasets()

}

public int ExhaustiveIncrementalDatasetUpload(int dataset_id, ref string payload)
/// <summary>
/// Progresses a payload through the whole upload process
/// </summary>
/// <param name="dataset">Dataset to upload to</param>
/// <param name="dataset_format">Format of the payload</param>
/// <param name="payload">File contents to upload</param>
/// <param name="type">Type of upload to perform</param>
/// <returns></returns>
public int ExhaustiveDatasetUpload(IntegrityDataset dataset, DatasetFormat dataset_format, ref string payload, UploadAttempt.Type type)
{
IntegrityDataset _dataset = _configuration.GetDataset(dataset_id);
DatasetFormat _format = _dataset.m_dataset_formats.First();
UploadAttempt upload_attempt = new UploadAttempt(_dataset, _configuration.GetQualifiersForDataset(dataset_id), ref payload, _format, UploadAttempt.Type.Incremental);
UploadAttempt upload_attempt = new UploadAttempt(dataset, _configuration.GetQualifiersForDataset(dataset.m_id), ref payload, dataset_format, type);

UploadAttemptResponse created_status = default(UploadAttemptResponse);
created_status = _integrity_interface.CreateUpload(ref upload_attempt);
Expand All @@ -141,4 +147,34 @@ public int ExhaustiveIncrementalDatasetUpload(int dataset_id, ref string payload

return uploaded_status.GetId;
}

/// <summary>
/// Transfer an upload attempt
/// </summary>
/// <param name="upload_attempt">Upload attempt to transfer</param>
/// <returns></returns>
public UploadAttemptResponse TransferUploadAttempt(UploadAttempt upload_attempt)
{
return _integrity_interface.CreateUpload(ref upload_attempt);
}

/// <summary>
/// Validate an existing upload attempt
/// </summary>
/// <param name="upload_attempt">Upload attempt to validate</param>
/// <returns></returns>
public UploadAttemptResponse ValidateUploadAttempt(UploadAttempt upload_attempt)
{
return _integrity_interface.ValidateUpload(upload_attempt.ID);
}

/// <summary>
/// Upload an existing upload attempt, staging it
/// </summary>
/// <param name="upload_attempt">Upload attempt to upload</param>
/// <returns></returns>
public UploadAttemptResponse UploadUploadAttempt(UploadAttempt upload_attempt)
{
return _integrity_interface.Upload(upload_attempt.ID);
}
}
2 changes: 1 addition & 1 deletion IntegrityIntegration/UploadAttemptResponse.cs
Expand Up @@ -30,7 +30,7 @@

namespace IntegrityAPI
{
class UploadAttemptResponse
public class UploadAttemptResponse
{

private int _id;
Expand Down

0 comments on commit b83e2e4

Please sign in to comment.