Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark user_id as required for grants.deleteByUserId #930

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/management/__generated/managers/grants-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ export class GrantsManager extends BaseAPI {
* @throws {RequiredError}
*/
async deleteByUserId(
requestParameters: DeleteGrantsByUserIdRequest = {},
requestParameters: DeleteGrantsByUserIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<void>> {
runtime.validateRequiredRequestParams(requestParameters, ['user_id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'user_id',
Expand Down
2 changes: 1 addition & 1 deletion src/management/__generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12774,7 +12774,7 @@ export interface DeleteGrantsByUserIdRequest {
* user_id of the grant to delete.
*
*/
user_id?: string;
user_id: string;
}
/**
*
Expand Down
27 changes: 26 additions & 1 deletion test/management/grants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
});
});
});