(key: string)
| 867 | } |
| 868 | |
| 869 | async rm(key: string): Promise<void> { |
| 870 | await this._init(); |
| 871 | |
| 872 | const cachedEntity = this.keyToBoxEntity[key]; |
| 873 | const fileID = cachedEntity?.id; |
| 874 | if (cachedEntity === undefined || fileID === undefined) { |
| 875 | throw Error(`no fileID found for key=${key}`); |
| 876 | } |
| 877 | |
| 878 | const access = await this._getAccessToken(); |
| 879 | const auth = new BoxDeveloperTokenAuth({ token: access }); |
| 880 | const client = new BoxClient({ auth }); |
| 881 | |
| 882 | if (cachedEntity.isFolder) { |
| 883 | await client.folders.deleteFolderById(fileID, { |
| 884 | queryParams: { recursive: true }, |
| 885 | }); |
| 886 | } else { |
| 887 | await client.files.deleteFileById(fileID); |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | async checkConnect(callbackFunc?: any): Promise<boolean> { |
| 892 | // if we can init, we can connect |
no test coverage detected