This method is used to delete files stored as attachments or under S-Drive folders.
List<ResultObject> deleteFiles(List<ID> wipIds, String objectId)
wipIds: List of IDs of "file" records (either attachments or S-Drive Folder files).
objectId: Id of the parent object. You can use 15-character or 18-character ID.
Return Value: The method will return a list of ResultObject (Figure 8) which holds delete status information for each file record.

Example code:
List<Id>wipIds = new List<Id>();
wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));

If you enable versioning and add a latest version file id into wipIds list, all versions of that file will also be deleted. You can also delete a single old version file by adding its id into wipId list.