-
Notifications
You must be signed in to change notification settings - Fork 0
SFTPService
The SFTPService class extends the BaseService class, providing specialized functionality for interacting with SFTP and FTP services in Salesforce Commerce Cloud (SFCC). It manages the creation of protocol-specific clients, execution of SFTP/FTP operations, and offers flexibility for both single and multiple operations.
Inherits from: BaseService
Description: Executes an SFTP/FTP service call based on the provided parameters. It utilizes the initServiceClient and execute methods to manage the client connection and handle the specified operation.
-
Parameters:
-
params(SFTPParams): The parameters for creating and executing the SFTP/FTP service request.
-
-
Returns:
-
dw.svc.Result: The result of the service call, either success or error.
-
Description: Creates a protocol-specific client object (either FTP or SFTP) based on the service configuration and credentials.
-
Parameters:
-
svc(dw.svc.FTPService): The FTP/SFTP service instance.
-
-
Returns:
-
Object: The initialized client object (eitherdw.svc.FTPClientordw.svc.SFTPClient).
-
Description: Executes the specified SFTP/FTP operation. Supports both single and multiple operations via callbacks.
-
Parameters:
-
svc(dw.svc.FTPService): The FTP/SFTP service instance. -
params(SFTPParams): The parameters for executing the operations.
-
-
Returns:
-
*: The result of the executed operation.
-
-
Throws:
-
Error: If no valid operation with arguments or execute callback is provided.
-
Description: Returns an FTP or SFTP client based on the specified protocol type.
-
Parameters:
-
protocolType(string): The protocol type (ftporsftp).
-
-
Returns:
-
dw.net.FTPClient | dw.net.SFTPClient: The initialized client object.
-
-
Throws:
-
Error: If the protocol type is not recognized.
-
Represents parameters for the SFTP/FTP service.
-
Type:
Object-
operation('cd' | 'del' | 'get' | 'getBinary' | 'getFileInfo' | 'list' | 'mkdir' | 'put' | 'putBinary' | 'removeDirectory' | 'rename'): The SFTP/FTP operation to be executed. -
args(*[]): The arguments for the operation. -
onExecute(function): Callback function for executing multiple operations.
-
Callback function for executing SFTP/FTP operations.
-
Type:
function-
Parameters:
-
svc(dw.svc.FTPService): The FTP/SFTP service instance.
-
-
Returns:
-
*: The result of the executed operations.
-
-
Parameters: