function obj = sftp(host, varargin)
%SFTP Create an SFTP object.
%   S = SFTP(host, user) returns an SFTP object. If only a host and user is
%   provided, SSH keys are retrieved from the default location. On Unix and
%   Mac OS, the default location is "$HOME/.ssh" and the keys are stored in
%   files named "id_rsa" and "id_rsa.pub". On Windows, the default location
%   is "%HOMEDRIVE%%HOMEPATH%\.ssh" and the keys are stored in files named
%   "id_rsa" and "id_rsa.pub".
%
%   S = SFTP(host, user, "PublicKeyFile", value, "PrivateKeyFile", value)
%   returns an SFTP object using the key files at the supplied locations.
%
%   S = SFTP(host, user, "Password", value) returns an SFTP object
%   using the password specified.
%
%   Name-Value Pairs:
%   -------------------------------------------------------------------------------
%
%   "DatetimeType"       - The type to use for date field in the output
%                          from dir when run on the remote SFTP server. Specified
%                          as "datetime" or "text".
%
%   "ServerSystem"       - Type of OS running on the SFTP server, specified
%                          as "unix" or "Windows".
%
%   "ServerLocale"       - The locale used to interpret the date field in
%                          the output of dir.
%
%   "DirParserFcn"       - Customize the parsing of the dir string listings
%                          into a struct array.
%
%   "StartingFolder"     - Specify the folder to cd into at connection
%                          time.
%
%   SFTP Methods:
%   -----------------------------------------------------------------------
%
%   cd     - Change or view current folder on SFTP server
%   close  - Close connection to SFTP server
%   delete - Delete file on SFTP server
%   dir    - List folder contents on SFTP server
%   mget   - Download files from SFTP server
%   mkdir  - Make new folder on SFTP server
%   mput   - Upload file or folder to SFTP server
%   rename - Rename file on SFTP server
%   rmdir  - Remove folder on SFTP server
%
%   SFTP Properties:
%   -----------------------------------------------------------------------
%
%   Host                      - Name of SFTP server
%   User                      - Name of authorized account
%   Port                      - Port used to connect to SFTP server
%   ServerSystem              - Type of OS running on SFTP server
%   DatetimeType              - The type to use for date field in the
%                               output from dir when run on SFTP server
%   ServerLocale              - Locale for reading dates from SFTP server
%   DirParserFcn              - How to parse the output of SFTP server's
%                               LIST command
%   StartingFolder            - Specify the folder that will be the current
%                               folder when connection is made
%   RemoteWorkingDirectory    - Current working directory on SFTP server

%   Copyright (c) 2020-2023 The MathWorks, Inc.

try
    obj = matlab.io.sftp.SFTP(host, varargin{:});
catch ME
    throw(ME);
end
end
