Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import wpcom from 'calypso/lib/wp';
export interface SftpUser {
username: string;
password: string;
}
export async function fetchSftpUsers( siteId: number ): Promise< SftpUser[] > {
const { users } = await wpcom.req.get( {
path: `/sites/${ siteId }/hosting/ssh-users`,
apiNamespace: 'wpcom/v2',
} );
return users.map( ( username: string ) => ( {
username,
} ) );
}
export async function createSftpUser( siteId: number ): Promise< SftpUser > {
return wpcom.req.post( {
path: `/sites/${ siteId }/hosting/ssh-user`,
apiNamespace: 'wpcom/v2',
} );
}
export async function resetSftpPassword(
siteId: number,
sshUsername: string
): Promise< SftpUser > {
return wpcom.req.post( {
path: `/sites/${ siteId }/hosting/ssh-user/${ sshUsername }/reset-password`,
apiNamespace: 'wpcom/v2',
} );
}