diff --git a/.changeset/nice-fireants-marry.md b/.changeset/nice-fireants-marry.md new file mode 100644 index 0000000..4d283e9 --- /dev/null +++ b/.changeset/nice-fireants-marry.md @@ -0,0 +1,5 @@ +--- +"@absmach/magistrala-sdk": patch +--- + +update documentation diff --git a/.changeset/tall-pandas-chew.md b/.changeset/tall-pandas-chew.md new file mode 100644 index 0000000..a4fc633 --- /dev/null +++ b/.changeset/tall-pandas-chew.md @@ -0,0 +1,5 @@ +--- +"@absmach/magistrala-sdk": patch +--- + +Update remove user from domain to remove the need for relation diff --git a/examples/domains.ts b/examples/domains.ts index bc94482..91eaa72 100644 --- a/examples/domains.ts +++ b/examples/domains.ts @@ -126,8 +126,7 @@ mySdk.domains.AddUsertoDomain( mySdk.domains.RemoveUserfromDomain( '', - ['', ''], - 'administrator', + '', token ) .then((response: any) => { diff --git a/src/domains.ts b/src/domains.ts index 7ba1c93..86dee0e 100644 --- a/src/domains.ts +++ b/src/domains.ts @@ -377,16 +377,15 @@ export default class Domains { } } - public async RemoveUserfromDomain (domainID: string, userIDs: string[], relation: Relation, token: string): Promise { + public async RemoveUserfromDomain (domainID: string, userID: string, token: string): Promise { // RemoveUserfromDomain removes user from domain. /** * @method RemoveUserfromDomain - Removes user from domain. * @param {string} domainID - domain ID. - * @param {array} userIDs - array of user IDs. - * @param {string} relation - user relation to domain such as 'administrator', 'member'. + * @param {string} userID - user ID. * @returns {object} - returns an object Response that carries the status code and a response message. */ - const req = { user_ids: userIDs, relation } + const req = { user_id: userID } const options: RequestInit = { method: 'POST', headers: { diff --git a/tests/domains.test.ts b/tests/domains.test.ts index 414f344..96e34c5 100644 --- a/tests/domains.test.ts +++ b/tests/domains.test.ts @@ -157,7 +157,7 @@ describe('Domains', () => { } fetchMock.mockResponseOnce(JSON.stringify(removeUserfromDomainResponse)) - const response = await sdk.domains.RemoveUserfromDomain(domainId, userIds, relation, token) + const response = await sdk.domains.RemoveUserfromDomain(domainId, userId, token) expect(response).toEqual(removeUserfromDomainResponse) }) })