diff --git a/package.json b/package.json index 0f17ca1f..8fe13c6e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@internxt/sdk", "author": "Internxt ", - "version": "1.10.0", + "version": "1.10.1", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", diff --git a/src/drive/storage/index.ts b/src/drive/storage/index.ts index 3a6d8960..9af18a77 100644 --- a/src/drive/storage/index.ts +++ b/src/drive/storage/index.ts @@ -623,6 +623,13 @@ export class Storage { ); } + /** + * @returns whether the user has uploaded any files + */ + public hasUploadedFiles(): Promise<{ hasUploadedFiles: boolean }> { + return this.client.get('/users/me/upload-status', this.headers()); + } + /** * Returns a list of the n most recent files * @param limit diff --git a/test/drive/storage/index.test.ts b/test/drive/storage/index.test.ts index a8eb49bf..58767b17 100644 --- a/test/drive/storage/index.test.ts +++ b/test/drive/storage/index.test.ts @@ -775,6 +775,22 @@ describe('# storage service tests', () => { }); }); + describe('The user already uploaded any file', () => { + it('it should return a boolean indicating if the user already uploaded any file or not', async () => { + const { client, headers } = clientAndHeaders({}); + const callStub = sinon.stub(httpClient, 'get').resolves({ + hasUploadedFiles: true, + }); + + const body = await client.hasUploadedFiles(); + + expect(callStub.firstCall.args).toEqual(['/users/me/upload-status', headers]); + expect(body).toEqual({ + hasUploadedFiles: true, + }); + }); + }); + describe('space limit', () => { it('should call with right params & return response', async () => { // Arrange