You can use SDriveTools API class to create a public access link, after configuring S-URL from S-Drive Configuration tab. To create a public access link using API class call the following method:

createPublicLink(List<String> fileIds, String objectFileName, String
objectId, String objectName, String objectRelationshipName, Boolean
isAccessible, Boolean isUpdatable, Boolean isDeletable, Boolean
isCreatable, Datetime expirationDate, String password, String IpRange,
Boolean isDownloadLink, Boolean isOpen)

The method signature is explained as follows:
@param List<String> fileIds: List of ids of files & folders
@param String objectFileName: Full object name of the file, e.g. 'cg_AccountFile_c'
@param String objectId: Id of parent object, i.e. for account files it is id of Account record
@param String objectName: Name of the parent object, i.e. for account files it is "Account"
@param String objectRelationshipName: The name of the relationship field that between parent and file objects. e.g. relationship field name of between account & account files is "Account__r"
@param Boolean isAccessible: It enables/disables file read feature for public user
@param Boolean isUpdatable: It enables/disables file edit feature for public user
@param Boolean isDeletable: It enables/disables file delete feature for public user
@param Boolean isCreatable: It enables/disables file upload & create new folder feature for public user
@param Datetime expirationDate: Expire date for the link
@param String password: The minimum password length should be 4 characters
@param String IpRange: Two IP addresses as string separated by a "-" dash
@param Boolean isDownloadLink: If true, file is downloaded
@param Boolean isOpen: If true, file is opened in component