Download wp-calypso/client/dashboard/data/site-hosting-sftp.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 814 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/site-hosting-sftp.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/dashboard/data/site-hosting-sftp.ts
-
curl -L -o site-hosting-sftp.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/site-hosting-sftp.ts
814 Bytes
| 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', | |
| } ); | |
| } | |