diff --git a/src/management/__generated/managers/grants-manager.ts b/src/management/__generated/managers/grants-manager.ts index 33f8609b1..485edfd0d 100644 --- a/src/management/__generated/managers/grants-manager.ts +++ b/src/management/__generated/managers/grants-manager.ts @@ -45,9 +45,11 @@ export class GrantsManager extends BaseAPI { * @throws {RequiredError} */ async deleteByUserId( - requestParameters: DeleteGrantsByUserIdRequest = {}, + requestParameters: DeleteGrantsByUserIdRequest, initOverrides?: InitOverride ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['user_id']); + const queryParameters = runtime.applyQueryParams(requestParameters, [ { key: 'user_id', diff --git a/src/management/__generated/models/index.ts b/src/management/__generated/models/index.ts index 43a16cbd6..572fd9b0e 100644 --- a/src/management/__generated/models/index.ts +++ b/src/management/__generated/models/index.ts @@ -12774,7 +12774,7 @@ export interface DeleteGrantsByUserIdRequest { * user_id of the grant to delete. * */ - user_id?: string; + user_id: string; } /** * diff --git a/test/management/grants.test.ts b/test/management/grants.test.ts index d4d3b4687..b437347c7 100644 --- a/test/management/grants.test.ts +++ b/test/management/grants.test.ts @@ -2,7 +2,7 @@ import nock from 'nock'; const API_URL = 'https://tenant.auth0.com/api/v2'; -import { GrantsManager, ManagementClient } from '../../src/index.js'; +import { GrantsManager, ManagementClient, RequiredError } from '../../src/index.js'; describe('GrantsManager', () => { let grants: GrantsManager; @@ -148,5 +148,30 @@ describe('GrantsManager', () => { done(); }); }); + + describe('#deleteByUserId', () => { + const user_id = '5'; + let request: nock.Scope; + + beforeEach(() => { + request = nock(API_URL).delete(`/grants/?user_id=${user_id}`).reply(200, {}); + }); + + it('should return a promise when no callback is given', (done) => { + grants.deleteByUserId({ user_id }).then(done.bind(null, null)); + }); + + it(`should perform a DELETE request to /grants/${id}`, (done) => { + grants.deleteByUserId({ user_id }).then(() => { + expect(request.isDone()).toBe(true); + + done(); + }); + }); + + it('should return an error when client_id is not sent', async () => { + await expect(grants.deleteByUserId({} as any)).rejects.toThrowError(RequiredError); + }); + }); }); });