Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This method is used to complete attachments upload once the files have been uploaded to Amazon S3.
List<ResultObject> completeUpload(List<ID> wipIds)
Parameters:
wipIds: List of Salesforce ids for attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.

versionIds(Optional): List of AWS S3 versionIds ids for the attachment “file” record. These versionIds have been returned from the x-amz-version-id field from the AWS REST API response Headers. The array should match the order of of wipIds.

attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.
Return Value: The method will return the list of Result Object (Figure 127), which holds filecompletion status information.

...

Code Block
List<Id>wipIds = new List<Id>();
wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));
List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds);

With VersionIds.
Assume you have a method uploadToS3 that uses uploadRequestInfos as a parameter and returns a RestResponse object.

Code Block
List<Id>wipIds = new List<Id>();
wipIds.add(ID.valueOf(uploadRequestInfos.fileWipId));
RestResponse restResponse = uploadToS3(uploadRequestInfos);
Map<String, String> headers = restResponse.getHeaders();
String versionId = headers.get('x-amz-version-id');
List<String> versionIds = new List<String>();
versionIds.add(versionId);
List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds, versionIds);